从URL中的Apache2删除的.html [英] Remove .html from url in apache2
本文介绍了从URL中的Apache2删除的.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想删除的.html 因此该网站www.example.com/login~~V
I am trying to remove .html so the site is www.example.com/login
的login.html位于/var/www/html/login.html
login.html is located in /var/www/html/login.html
我在/var/www/html/.htaccess创建的.htaccess
I created .htaccess in /var/www/html/.htaccess
和我放在:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
似乎这不工作。谁能告诉我什么是错?
This doesn't seem to work. Can someone tell me what is wrong?
推荐答案
尝试这种方式。
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ $1.html [L]
显然,你改变了你的问题。
Apparently you changed your question.
这篇关于从URL中的Apache2删除的.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文