隐藏扩展名在.htaccess扩展名、htaccess

2023-09-02 11:25:56 作者:残阳

大家好 我有一个问题,我的档案有html的延伸,但我想,当文件打开brownser的延伸不得不hidden.eg file.html到文件。 先感谢

Hi All i have a problem that my file have .html extention but i want that when the file open in brownser the extention had hidden.e.g file.html to file. Advance thanks

推荐答案

在你的的.htaccess 文件中使用这样的:

In your .htaccess file use this:

RewriteEngine on  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteCond %{REQUEST_FILENAME}.html -f  
RewriteRule ^(.*)$ $1.html

现在你可以使用林家如 http://www.mysite.com/contact ,而不是 http://www.mysite.com /contact.html

Now you can use lins like http://www.mysite.com/contact rather than http://www.mysite.com/contact.html.

希望这有助于!