如何删除的index.html index.php文件与htaccess的 [英] How do I remove index.html index.php with htaccess
本文介绍了如何删除的index.html index.php文件与htaccess的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这些URL在我的博客
I have these urls in my blog
http://myblog.com/news/post1/index.php
http://myblog.com/updates/post3/index.html
http://myblog.com/index.html
http://myblog.com/blog/post4/index.php
如何设置的.htaccess,使所有的网址将结束/
How do I setup .htaccess so that all the urls will end with "/"
http://myblog.com/news/post1/
http://myblog.com/updates/post3/
http://myblog.com/
http://myblog.com/blog/post4/
在此先感谢!
Thanks in advance!
推荐答案
要删除PHP扩展从PHP文件:
To remove the .php extension from a PHP file:
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
如果你想从一个HTML文件中删除.html扩展名:
If you want to remove the .html extension from a html file:
RewriteRule ^([^\.]+)$ $1.html [NC,L]
或看到这个帖子:
这篇关于如何删除的index.html index.php文件与htaccess的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文