Apache2 重写规则导致 404
Apache2 Rewrite Rules result in 404
我是 运行 Ubuntu 20.04 lts with Apache 2。我启用了 mod_rewrite,但是当我的规则被启用时它会导致 404 错误。
这是我当前的(精简版).htaccess 文件,我仍然收到 404:
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)(|/)$ index.php?page=
我已经像这样配置了我的虚拟主机:
<VirtualHost *:80>
ServerName website
ServerAlias www.website
ServerAdmin webmaster@localhost
DocumentRoot /var/www/website
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/website/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
我做错了什么?它适用于 IIS。
Nvm 已经解决了,不知何故 MultiViews 选项导致了问题,或者我犯了一个类型错误。
已替换
Options Indexes FollowSymLinks MultiViews
有了这个
Options Indexes FollowSymLinks
现在可以使用了
我是 运行 Ubuntu 20.04 lts with Apache 2。我启用了 mod_rewrite,但是当我的规则被启用时它会导致 404 错误。
这是我当前的(精简版).htaccess 文件,我仍然收到 404:
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)(|/)$ index.php?page=
我已经像这样配置了我的虚拟主机:
<VirtualHost *:80>
ServerName website
ServerAlias www.website
ServerAdmin webmaster@localhost
DocumentRoot /var/www/website
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/website/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
我做错了什么?它适用于 IIS。
Nvm 已经解决了,不知何故 MultiViews 选项导致了问题,或者我犯了一个类型错误。
已替换
Options Indexes FollowSymLinks MultiViews
有了这个
Options Indexes FollowSymLinks
现在可以使用了