I am getting ready to take a new site live and want to do a 301 redirect on old pages that no longer exist. I have a set of .htaccess rules I use on every site to remove index.php and it has always worked great, but I think I have a conflict somewhere. URLs I want to rewrite only work if you manually add index.php into the URL. For example…
RewriteRule /specifications.php <a href="http://google.com">http://google.com</a> [I,RP,L]...does not work (just displays home page as I have no 404 page designated), but if you insert index.php in front of the URL it will redirect properly.
Here is my .htaccess I use on every site
<IfModule mod_rewrite.c>
# Enable Rewrite Engine
# ------------------------------
RewriteEngine on
RewriteBase /
# Update requests for old site pages to new location
# ----------------------------------------------------------------
RewriteRule /contact.php /contact [R=301]
RewriteRule /history.php /history [R=301]
RewriteRule (/test/specifications.php) /products [I,R,L]
# Redirect index.php Requests
# ------------------------------
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{THE_REQUEST} !/sys_ezgutter/.*
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]
# Standard ExpressionEngine Rewrite
# ------------------------------
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>