如何为Apache2.2启用mod_rewrite我在Vista的机器上安装了新的Apache2.2,一切正常,除了MOD重写。我没有评论LoadModule rewrite_module modules/mod_rewrite.s但是我重写的规则都不起作用,即使是像这样简单的规则RewriteRule not_found %{DOCUMENT_ROOT}/index.php?page=404我使用的所有规则都在我的主机上工作,所以它们应该没问题,所以我的问题是,Apache配置中有什么隐藏的东西可以阻止mod重写吗?
4 回答
天涯尽头无女友
TA贡献1831条经验 获得超9个赞
mod_rewrite
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
sudo service apache2 restart
sudo systemctl restart apache2
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>.htaccessDocumentRootindex.phpDocumentRoot
DocumentRoot
httpdocs/ .htaccess index.php images/ hello.png js/ jquery.js css/ style.css includes/ app/ app.php
.htaccesshttpdocs/index.phpincludes/app
函数式编程
TA贡献1807条经验 获得超9个赞
RewriteEngine On
.htaccess
AllowOverride all
<Directory>
慕娘9325324
TA贡献1783条经验 获得超5个赞
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>
AllowOverride NoneAllowOverride All
- 4 回答
- 0 关注
- 1233 浏览
添加回答
举报
0/150
提交
取消
