0

Is there any setting for url limit in Yii 2?

Some of my urls are over 300 characters and I get a 403 Forbidden code;

http://website/servicii-de-proiectare-asistenta-tehnica-din-partea-proiectantului-pe-perioada-derularii-lucrarilor-si-executie-de-lucrari-pentru-proiectul-%E2%80%9Emodernizare-drumuri-comunale-dc----dc----si-dc---a-de-pe-raza-comunei-lunca-judetul-boto-ani%E2%80%9D-863506-switch.html

If I shorten the url, it works.

this is my urlmanager rule:

'<title:(.*)>-<id:([0-9]+)>-access-not-granted.html' => 'member/licitatii/access-not-granted',

tereško
  • 58,060
  • 25
  • 98
  • 150
Ionut Flavius Pogacian
  • 4,750
  • 14
  • 58
  • 100

2 Answers2

1

I tried to find some information regarding this issue and surprisingly enough, I didn't found a thing regarding URL length permitted.

However, I found a Yii way to solve your issue: Short URL Yii extension presented here - http://www.yiiframework.com/extension/google-url-shortener/

Also, please read this documentation that better explains how Yii treats URL routs: http://www.larryullman.com/2013/02/18/understanding-routes-in-the-yii-framework/

I know this does not solve your problem directly, but hope it gets you somewhere!

L.E: Here you have the bitly extension for Short URL's: http://www.yiiframework.com/extension/bitly-url-shortener/

Keep on coding,
Ares.

Ares Draguna
  • 1,641
  • 2
  • 16
  • 32
0

Why would that rule apply to your URL? From what I can see your URL will never trigger that rule.

I do not think there is a limit with the string of the URL in Yii2, try deleting some of the first part of the string to test this. try with an url like

http://website/proiectul-%E2%80%9Emodernizare-drumuri-comunale-dc----dc----si-dc---a-de-pe-raza-comunei-lunca-judetul-boto-ani%E2%80%9D-863506-switch.html

You might have problems because you have diacritics in the URL, try without them.

Mihai P.
  • 9,307
  • 3
  • 38
  • 49