Reputation: 169
using this in my .htaccess:
RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
But the site is displaying a 404 Not Found, even though I have the file.
The file is ishared.html. The redirect works, but it takes to a not found, if you go to http://headupshouldersback.com/ishared.html
Any tips? Thanks!
EDIT: The following gave me 500 server error on my site:
RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
RewriteRule ^(.*) /$1.html [QSA,L]
Upvotes: 0
Views: 1900
Reputation: 1759
After your redirection:
RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
Add to the following line:
RewriteRule ^(.*) /index.php?page=$1.html [QSA,L]
It is going to work. This will show the contents of ishared.html
if you do the request for ishared
.
EDIT:
It got into a loop, sorry, you need to use some php code.
index.php:
<?php file_get_contents( (isset($_GET['page'])) ? $_GET['page'] : "error.html"); ?>
Upvotes: 2