在什么情况下.htaccess对Apache不起作用?

在什么情况下.htaccess对Apache不起作用?,apache,.htaccess,rewrite,Apache,.htaccess,Rewrite,六、访问: RewriteEngine on RewriteCond $1 !^(index\.php|audio|editor|upload|images|js|css|robots\.txt|sitemap\.xml) RewriteRule ^(.*)$ /index.php?$1 [L] 当我尝试浏览报告404时,它无法正常工作 是因为它是虚拟主机吗 <VirtualHost *:80> ... ... 检查apache错误日志首先确保为apache启用了重写,并且遵守

六、访问:

RewriteEngine on
RewriteCond $1 !^(index\.php|audio|editor|upload|images|js|css|robots\.txt|sitemap\.xml)
RewriteRule ^(.*)$ /index.php?$1 [L]
当我尝试浏览报告404时,它无法正常工作

是因为它是虚拟主机吗

<VirtualHost *:80>
...

...

检查apache错误日志

首先确保为apache启用了重写,并且遵守.htaccess文件的规则

然后,您可以简单地将物理上不存在的任何内容重定向到索引:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [QSA,L]