I want to hide (remove) the file extension (shtml) in my web page. The website is hosted in an apache server running a linux operating system.
I have tried various codes (found in google search: removing file extension) written in .htaccess files, but give me no luck.
After keep on trying and modifying codes from several sources, finally I can get what I want:
domain/foo.shtml will be appeared as domain/foo
and if I type
domain/foo it opens the shtml page correctly and appeared as domain/foo
Basically the *.shtml will never appeared in the web browser address bar.
The codes written in .htaccess are the following:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.shtml -f
RewriteRule ^(.*)$ $1.shtml
RewriteCond %{THE_REQUEST} ^GET\s.+\.shtml
RewriteRule ^(.+)\.shtml$ /$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.shtml -f
RewriteRule ^(.*)$ $1.shtml
RewriteCond %{THE_REQUEST} ^GET\s.+\.shtml
RewriteRule ^(.+)\.shtml$ /$1 [R=301,L]
The codes are implemented in the new Impact website. Note in IE9, some pages are greyed-out because lightbox.js does not work correctly.