隐藏扩展名在.htaccess [英] Hide extension in .htaccess

查看:171
本文介绍了隐藏扩展名在.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好 我有一个问题,我的档案有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.

希望这有助于!

这篇关于隐藏扩展名在.htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆