Reputation: 1912
I am facing some problem on URL rewriting.
I write a rule without base key like below:-
RewriteRule ^en/([\w-]+)/([\w-=]+)/([\w-=]+)/([\w-=]+)$ landing.php?n=$1&p=$2&c=$3&k=$4 [QSA,L]
RewriteRule ^([\w-]+)/([\w-=]+)/([\w-=]+)/([\w-=]+)$ landing.php?n=$1&p=$2&c=$3&k=$4 [QSA,L]
I have below URLs:-
http://localhost/site/en/video/vi/ca/key //en URL
http://localhost/site/video/vi/ca/key //normal URL
Above both URL is working fine.
But Below URL create problem, this should not work
http://localhost/site/en/video/ca/key
en URL, working like normal URL. This goes to second rule. Here first rule is not working. GET['n'] shows n= en but this should not work because vi is not present here or this should be n= video.
Please check and guide me on this.
Thanks in advance.
Upvotes: 1
Views: 75
Reputation: 2588
You have to add RewriteBase
in the very beginning of you htaccess like below
RewriteBase /site/
RewriteRule ^en/(([\w-]+)\/){1,4} landing.php?n=$1&p=$2&c=$3&k=$4 [QSA,L]
RewriteRule ^([\w-]+)/([\w-=]+)/([\w-=]+)/([\w-=]+)$ landing.php?n=$1&p=$2&c=$3&k=$4 [QSA,L]
Upvotes: 2