Php htaccess文件不工作

Php htaccess文件不工作,php,.htaccess,Php,.htaccess,我有一个带有以下代码的.htaccess文件: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} (/|\.html|/[^.]*)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([A-Za-z0-9-_]+)/?$ $1.html [NC] </IfModule> 重

我有一个带有以下代码的
.htaccess
文件:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_URI} (/|\.html|/[^.]*)$ [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([A-Za-z0-9-_]+)/?$ $1.html [NC]
</IfModule>

重新启动发动机
重写基/
RewriteCond%{REQUEST_URI}(/| \.html |/[^.]*)$[NC]
重写cond%{REQUEST_FILENAME}-F
重写规则^([A-Za-z0-9-\]+)/?$$1.html[NC]
但它不起作用。我想更改URL,例如,
www.example.com/about.html
www.example.com/about
等等

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
如果下次不理解,请将其保存在
.htaccess
代码段文件中。用需要删除的文件扩展名替换
.html


如果下次不理解,请将其保存在
.htaccess
代码段文件中。用您需要删除的文件扩展名替换
.html

“很紧急”您不应承诺无法交付的内容。但请告诉我什么是“不起作用”。日志中有错误吗?@Piyush首先在您的httpd.conf中设置了
AllowOverride
,以便htaccess正常工作?“它很紧急”您不应该承诺无法交付的内容。但请告诉我什么是“不起作用”。日志中有错误吗?@Piyush首先在httpd.conf中设置了
AllowOverride
,以便htaccess工作?