0

So I have hyperlinks on all my pages leading to shop.html and index.html and music.html. Is there a way (without me having to go through every file taking out the .html) to redirect all these hyperlinks. I have had a look at .htaccess:

Options +ExecCGI +FollowSymLinks -MultiViews

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ /$1.html [L]

But this doesn't seem to help at all!

If I don't have this file I can still remove the extension and the page is working.

maxisme
  • 3,974
  • 9
  • 47
  • 97
  • 1
    http://stackoverflow.com/questions/5730092/how-to-remove-html-from-url http://stackoverflow.com/questions/5574442/why-does-this-cause-an-infinite-request-loop – Prix Feb 16 '14 at 07:25
  • Your .htaccess is only handling the rules to map the non-html URLs to the html files. See the linked question for how to achieve automatic redirects. – Jonas Schäfer Feb 16 '14 at 10:21

1 Answers1

1

Try to change your RewriteRule to:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.html [NC,L]
Felix
  • 37,892
  • 8
  • 43
  • 55
  • I have tried that but nothing changes. I am just putting the in a file named `.htaccess` in my root folder is that okay? – maxisme Feb 16 '14 at 07:35
  • this is not what I am looking for: http://stackoverflow.com/a/5730126/2768038 I don't want to have to alter all the links – maxisme Feb 16 '14 at 07:36