I am trying to do a redirect using .htaccess to make the visible URLs a bit neater using the following Rewriterules
As an example a request for /branches/london redirects to branchpage.php?id=london
This appears to works fine.
The problem comes when I need to do a further rewrite to a contact page.
/branches/london/contact should redirect to /branches/branchcontact.php?id=london
However, the first rule seems to be intercepting it.
I was under the impression that the [L] directive would prevent further rewriterules being applied, but this doesn't seem to be the case here.
Can someone help? What am I doing wrong?
I've tried swapping the rules around and other things, but the best I seem to be able to manage is to get the URL to rewrite to the contact page but it still loads the branch page.
<honk>*:O)</honk>
Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
Code:
RewriteRule ^branches/(.*)/contact$ branches/branchcontact.php?id=$1 [QSA,L]
RewriteRule ^branches/(.*)$ branches/branchpage.php?id=$1 [QSA,L]
As an example a request for /branches/london redirects to branchpage.php?id=london
This appears to works fine.
The problem comes when I need to do a further rewrite to a contact page.
/branches/london/contact should redirect to /branches/branchcontact.php?id=london
However, the first rule seems to be intercepting it.
I was under the impression that the [L] directive would prevent further rewriterules being applied, but this doesn't seem to be the case here.
Can someone help? What am I doing wrong?
I've tried swapping the rules around and other things, but the best I seem to be able to manage is to get the URL to rewrite to the contact page but it still loads the branch page.
<honk>*:O)</honk>
Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.