Apache ReWrite so we can omit the html extensions

preview_player
Показать описание
We will never undertsand users, this is a given so don't even try. her is a little trick though so when they can't remember to add the .html bit at the end you can ask Apache to do it for you using mod_rewite
Рекомендации по теме
Комментарии
Автор

So simple.  This was the fourth attempt at using mod rewrite for this purpose and by a long shot the easiest (not to mention the only one that worked).  For anyone too lazy to type the characters to add to your .htaccess or httpd.conf - Here you go: 

ReWriteCond %{REQUEST_FILENAME} !-d
ReWriteRule ^([^.]*[^./])$ /$1.html

Note: you can you change the '.html' to any extension to hide things like '.php' or '.jsp'.

lyaege
Автор

REQEST_FILENAME should be REQUEST_FILENAME. It works in this example but if it matched a directory it would have 404'd out.

adriansrealm