add .html except for root/
3 posts
• Page 1 of 1
add .html except for root/
Hi
I currently add .html to urls except for css, js, etc, however if I want to connect to the index page of the root i.e. my domain.com/ .html is being added to the request. How do I stop this from happening.
This is what I currently have:
[ISAPI_Rewrite]
RewriteEngine on
RewriteBase /
RewriteRule /httpd(?:\.ini|\.parse\.errors) / [F,I,O]
RewriteRule .*\.isrwhlp / [F,I,O]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteRule ^([^?]+)\/$ $1 [NC,R=301,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteRule ^([^?]+)\.html$ $1 [NC,R=301,L]
#Internally add extensions to request
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule (?!.*\.(?:css|jpg|js|png))(.*) $1.html
THANKS
I currently add .html to urls except for css, js, etc, however if I want to connect to the index page of the root i.e. my domain.com/ .html is being added to the request. How do I stop this from happening.
This is what I currently have:
[ISAPI_Rewrite]
RewriteEngine on
RewriteBase /
RewriteRule /httpd(?:\.ini|\.parse\.errors) / [F,I,O]
RewriteRule .*\.isrwhlp / [F,I,O]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteRule ^([^?]+)\/$ $1 [NC,R=301,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteRule ^([^?]+)\.html$ $1 [NC,R=301,L]
#Internally add extensions to request
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule (?!.*\.(?:css|jpg|js|png))(.*) $1.html
THANKS
Re: add .html except for root/
Hello,
I believe you have ISAPI_Rewrite 3, right?
Then let's try to fix it the following way:
RewriteEngine on
RewriteBase /
RewriteRule ^$ - [NC,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteRule ^([^?]+)/$ $1 [NC,R=301,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteRule ^([^?]+)\.html$ $1 [NC,R=301,L]
#Internally add extensions to request
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(?!.*\.(?:css|jpg|js|png))(.*) $1.html [NC,L]
I believe you have ISAPI_Rewrite 3, right?
Then let's try to fix it the following way:
RewriteEngine on
RewriteBase /
RewriteRule ^$ - [NC,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteRule ^([^?]+)/$ $1 [NC,R=301,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteRule ^([^?]+)\.html$ $1 [NC,R=301,L]
#Internally add extensions to request
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(?!.*\.(?:css|jpg|js|png))(.*) $1.html [NC,L]
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest