开发者

Hide, the file extension during client browsing

开发者 https://www.devze.com 2023-01-19 17:46 出处:网络
I am trying to hide the extensions of my scripts like .php or .html, so that the person browsing the website, will not have any idea about the language the page is开发者_开发技巧 developed at.

I am trying to hide the extensions of my scripts like .php or .html, so that the person browsing the website, will not have any idea about the language the page is开发者_开发技巧 developed at.

Any Idea how to do this?


i think id use the mod_rewrite like as follows:

http://gist.github.com/22877

this will allow anything with a valid page to be served but a 404 to be served if no page found

hope this helps

paul

try this

<IfModule mod_rewrite.c>
   Options +FollowSymLinks
   Options +Indexes
   RewriteEngine On
   RewriteCond %{SCRIPT_FILENAME} !-d
   RewriteRule ^([^\.]+)$ $1.php [NC,L]
</IfModule>

put that in the .htaccess of the root and it should propagate through all sub directories as well - that will take care of .php, you will need other rules for .html/.htm etc

0

精彩评论

暂无评论...
验证码 换一张
取 消