Reputation: 597
we are using codeiniter index.php removal code in .htaccess, it works fine for us. but we have some redirects in .htacess and codeiniter code conflect with our redirect pages.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Redirect 301 /articles/page-title.html http://domain.com/p/page-title.html
We redirected like this: "http://domain.com/p/page-title.html?/articles/page-title.html"
how we can fix and remove extra "?/articles/page-title.html" url from our redirect?
thaks
Upvotes: 1
Views: 779
Reputation: 51
I resolved a similar issue of it appending the old string at the end after a ? by using a RewriteRule with 301 rather than a Redirect. It's something to do with the rewrite rules always happening first. Putting the line in just after the RewriteBase so yours would look like this...
RewriteEngine on
RewriteBase /
RewriteRule ^(/articles/page-title.html)$ /p/page-title.html [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Upvotes: 0
Reputation: 6016
Try it with this in your .htaccess
. Note that I've moved your redirect further up
RewriteEngine on
RewriteBase /
Redirect 301 /articles/page-title.html http://domain.com/p/page-title.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Upvotes: 0