开发者

Hide, the file extension during client browsing

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜