ben03 Posted October 12, 2017 Share Posted October 12, 2017 Hi there, I am using a few of re-write rules, the last of which is not working. I assume it clashes with the others in some way? <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^oldurl.co.uk$ [OR] RewriteCond %{HTTP_HOST} ^www.oldurl.co.uk$ RewriteRule (.*)$ http://www.newurl.co.uk/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] RewriteCond %{HTTP_HOST} ^newurl.co.uk$ RewriteRule (.*) http://www.newurl.co.uk/$1 [R=301,L] </IfModule> Any pointers here would be greatly appreciated! Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted October 12, 2017 Share Posted October 12, 2017 All of those rules tell Apache that they should be the last rule matched, so if either of those other rules matches it's not going to execute any more. In particular, if that second rule matches it will not execute the third one. Link to comment Share on other sites More sharing options...
ben03 Posted October 13, 2017 Author Share Posted October 13, 2017 Thank you justsomeguy. I am assuming it is the ',L' that needs removing from each of the brackets? That is the danger of taking different snippets from different tutorials I suppose. Thanks for the help Link to comment Share on other sites More sharing options...
justsomeguy Posted October 13, 2017 Share Posted October 13, 2017 I don't think you'd want to do that, some of those rules you do want to be the last rule processed. You need to order them based on priority though, which rules do you want to happen first in which order. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now