random1 Posted October 12, 2009 Share Posted October 12, 2009 All I need my code to do is replace the .php extension to .html I have the following code snippet in my .htaccess file: # Redirect .php files to .html files (SEO friendly) [internal and External] RewriteBase / RewriteRule ^(.*)\.php$ /$1.html [R=301,L] RewriteRule ^(.*)\.html$ $1.php [R=301,L] It redirects but it cuts out the folder name I have on the server. E.g. it redirects: https://localhost/website/admin.php to https://localhost/admin.html NOT https://localhost/website/admin.html as it should. Any ideas? Quote Link to comment Share on other sites More sharing options...
Baronen Posted October 18, 2009 Share Posted October 18, 2009 # Redirect .php files to .html files (SEO friendly) [internal and External] RewriteBase / RewriteRule ^(.*)\.php$ /$1.html [R=301,L] RewriteRule ^(.*)\.html$ $1.php [R=301,L] You have to change your RewriteBase from / to /website I think it would do the trick Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.