Need help with a PHP redirect code
Posted: Tue Aug 24, 2010 9:44 pm
I have a website where I want to redirect a page to a link that has the file extension removed. For example, the page I have is named "franchise.php" and I want the search engines that rank our site to be redirected to just "franchise" (without the .php).
I placed the following code in my .htaccess file and it still does not seem to work. I have tried a few different variants of this code, but nothing seems to work right.
RewriteEngine on
RewriteCond %{THE_REQUEST} ^http://www.detailxperts.net/[A-Z]{3,9}\ /([^.]+\.)+php?\ HTTP
RewriteRule (.+)\.php?$ http://www.detailxperts.net/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^http://www.detailxperts.net/franchise\.php$ http://www.detailxperts.net/franchise [R=301,L]
I would appreciate any help to figure out what is going wrong here.
I placed the following code in my .htaccess file and it still does not seem to work. I have tried a few different variants of this code, but nothing seems to work right.
RewriteEngine on
RewriteCond %{THE_REQUEST} ^http://www.detailxperts.net/[A-Z]{3,9}\ /([^.]+\.)+php?\ HTTP
RewriteRule (.+)\.php?$ http://www.detailxperts.net/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^http://www.detailxperts.net/franchise\.php$ http://www.detailxperts.net/franchise [R=301,L]
I would appreciate any help to figure out what is going wrong here.