: "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
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?
More posts by @Sue5673885
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.