Mobile app version of vmapp.org
Login or Join
Sue5673885

: "Friendly URLs" rule in .htaccess interfering with some directories My .htaccess is set up to remove .html from URLs as follows: RewriteEngine on RewriteCond %{http_host} ^example.com [NC] RewriteRule

@Sue5673885

Posted in: #CleanUrls #Htaccess #Redirects #UrlRewriting

My .htaccess is set up to remove .html from URLs as follows:

RewriteEngine on
RewriteCond %{http_host} ^example.com [NC]
RewriteRule ^(.*)$ www.example.com/ [R=301,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ .html [NC,L]


This is causing problems with the file /help.html, which now gives a 403 Forbidden error:

Forbidden

You don't have permission to access /help/.html on this server.

Additionally, a 404 Not Found error was encountered while
trying to use an ErrorDocument to handle the request.


Is there a way to keep friendly URLs and make the help page work?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sue5673885

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sent6035632

Try this

RewriteEngine on
RewriteCond %{http_host} ^example.com [NC]
RewriteRule ^(.*)$ www.example.com/ [R=301,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} /help
RewriteRule . - [L]
RewriteRule ^([^]+)$ .html [NC,L]


I added a condition to your .htaccess to check if the Requested URI contains /help ,then it will be passed unchanged to its destination.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme