WITHOUT FILE ENDINGS

You can make this even better by ditching the file ending altogether, so that you can visit either http://www.mywebsite.com/horses orhttp://www.mywebsite.com/horses/:

RewriteEngine On
RewriteRule   ^horses/?$   Xu8JuefAtua.html  [NC]

The ? indicates that the preceding character is optional. So, in this case, the URL would work with or without the slash at the end. These would not be considered duplicate URLs by a search engine, but would help prevent confusion if people (or link checkers) accidentally added a slash. The stuff in brackets at the end of the rule gives Apache some further pointers. [NC] is a flag that means that the rule is case insensitive, sohttp://www.mywebsite.com/HoRsEs would also work.


source - http://www.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/






# vi /etc/httpd/conf/httpd.conf

<Directory "/var/www/test">

    RewriteEngine on

    RewriteRule ^test/?$ test.php

</Directory>




Posted by linuxism
,