开发者

How to change .php extension of website pages?

I have a website running on PHP. I want to remove the .php suffix from all of my webpages in such way that the user doesn't get to know what server side language is running.

How do I edit the displayed address 开发者_如何学编程in the address bar to not show the .php ?


With mod_rewrite in .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L] 


Apache has a feature, 'MultiViews' that allows the server to choose the correct extension when none is supplied. In your .htaccess or httpd.conf, you can add this:

Options MultiViews

If you have a file at /path/to/blah.php, it can be accessed as merely /path/to/blah.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜