Reputation: 1720
I have to re-name part of a URL, which is going to affect dozens of web pages:
http://www.example.com/old/web-page to http://www.example.com/new/web-page
So far I have:
RewriteRule old/(.*) http://www.example.com/new/$1 [R=301,L]
But I've read that RewriteRule can clash, which I'm using in .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
So, I have two questions: is the RewriteRule correct; and am I going to experience a clash of some kind?
Upvotes: 1
Views: 145
Reputation: 784908
Place your 301
rule just below RewriteEngine On
line:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule old(/.*)?$ /new$1 [R=301,L,NC]
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
Upvotes: 1