-1

*This question is unique because I do not need to remove the .html from the file extensions; I need to have internal links function correctly.

My site is http://purplerosecare.com and I tried creating a .htaccess page with the suggested copy/paste from the SO page: How to remove .html from URL

The code I used is below:

RewriteEngine on
RewriteBase /
RewriteCond %{http://www.proofers.co.uk/new} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ http://www.proofers.co.uk/new/$1 [R=301,L]

(The code & .htaccess have both been removed)

The problem I'm facing is whenever I click on a link in the navigation it sends me to http://www.proofers.co.uk/new/. How can I get the site functional again?

Community
  • 1
  • 1
CSJobs
  • 11
  • 1
  • 1
    possible duplicate of [How to remove .html from URL](http://stackoverflow.com/questions/5730092/how-to-remove-html-from-url) –  May 13 '15 at 00:16
  • I reviewed that one before (might even be the link I referred to in the post) but it is two separate issues. – CSJobs May 13 '15 at 00:24
  • No - it's only one issue. The code you have copied does exactly what one would expect, which you'd understand if you read it. Other answers on the linked question _do_ cover what you need. –  May 13 '15 at 00:29
  • Apologies but I don't understand. Since you have a grasp on the idea, mind sharing what I'm doing wrong? – CSJobs May 13 '15 at 00:55
  • Why do you even have that URI in your `.htaccess`? – EternalHour May 13 '15 at 01:17

1 Answers1

0

Try this in your Root/.htaccess file

#Remove html extensions from files
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*?)/?$ $1.html [L]
Amit Verma
  • 40,709
  • 21
  • 93
  • 115