如何為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>
.htaccess
DocumentRoot
index.php
DocumentRoot
DocumentRoot
httpdocs/ .htaccess index.php images/ hello.png js/ jquery.js css/ style.css includes/ app/ app.php
.htaccess
httpdocs/index.php
includes/app

函數式編程
TA貢獻1807條經驗 獲得超9個贊
RewriteEngine On
.htaccess
AllowOverride all
<Directory>

慕娘9325324
TA貢獻1783條經驗 獲得超4個贊
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>
AllowOverride None
AllowOverride All
- 4 回答
- 0 關注
- 1208 瀏覽
添加回答
舉報
0/150
提交
取消