从URL中的Apache2删除的.htmlURL、html

由网友(痴人说梦 2π/d)分享简介:我想删除的.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...

我想删除的.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.

阅读全文

相关推荐

最新文章