apache - htaccess Removed File Extension Yet Extension Still Exists -


using htaccess, able make html urls function without file extension, yet file extension still exists. example:

example.com/index , example.com/index.html both exist!

i want html file urls exist @ single stripped url (e.g. example.com/index )

i've tried manually deleting .html off of files, files load plain text. can achieve results want?

htaccess code:

rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ $1.html 

rewrite doesn't remove extension. allows not use , internally rewrites in rule. can't manually make file extension disappear. has there work. in addition current rule need check request , redirect extensionless url if enter .html on it. use rule , let me know how works you.

rewriteengine on rewritecond %{the_request} ^[a-z]{3,9}\ /([^&\ ]+).html rewriterule .* /%1? [r=301,l]  rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ $1.html [l] 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -