I have this rewrite rule
RewriteEngine On RewriteBase /location/ RewriteRule ^(.+)/?$ index.php?franchise=$1
Which is suppose to change this URL
http://example.com/location/kings-lynn
Into this one
http://example.com/location/index.php?franchise=kings-lynn
But instead I am getting this
http://example.com/location/index.php?franchise=index.php
Also, adding a railing slash breaks it. I get index.php page showing but none of the style sheets or javascript are loading.
I’m clearly doing something very wrong but I have no idea what despite spending all day R’ingTFM and many online primers and tutorials and questions on here.
Your problem is you are redirecting twice.
'location/index.php'matches the regex^(.+)/?$You want to possibly use the ‘if file does not exist’ conditional to make it not try mapping a second time.
And additonally, theres the [L,QSA] which tries to make it the ‘last’ rule ( Note, this is not entirely obvious how it works ) and append the query string to the query, so that
( i think )