Ubuntu系统启用Apache Mod_rewrite模块
2013-08-23 17:56
204 查看
在终端中执行
sudo a2enmod rewrite
指令后,即启用了 Mod_rewrite 模块。
另外,也可以通过将 /etc/apache2/mods-available/rewrite.load 连接到 /etc/apache2/mods-enabled/rewrite.load 来打开 Mod_rewrite 模块。用指令操作就是:
sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
一点小提示
事实上,当我在 Ubuntu 中采用上述做法并重启了 Apache 服务后,仍然无法正常 rewrite 网址。这里,还有一点需要注意的地方:
sudo vim /etc/apache2/sites-enabled/000-default
将其中的:
AllowOverride None
修改为:
AllowOverride All
上面的 /etc/apache2/sites-enabled/000-default 实则为 /etc/apache2/sites-available/default 的连接。而 AllowwOverride None 则会完全忽略 .htaccess 文件,自然其中所定义的 rewrite 规则也就不能生效了。
最后,别忘了使用下列指令来重启 Apache:
sudo /etc/init.d/apache2 restart.
sudo a2enmod rewrite
指令后,即启用了 Mod_rewrite 模块。
另外,也可以通过将 /etc/apache2/mods-available/rewrite.load 连接到 /etc/apache2/mods-enabled/rewrite.load 来打开 Mod_rewrite 模块。用指令操作就是:
sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
一点小提示
事实上,当我在 Ubuntu 中采用上述做法并重启了 Apache 服务后,仍然无法正常 rewrite 网址。这里,还有一点需要注意的地方:
sudo vim /etc/apache2/sites-enabled/000-default
将其中的:
AllowOverride None
修改为:
AllowOverride All
上面的 /etc/apache2/sites-enabled/000-default 实则为 /etc/apache2/sites-available/default 的连接。而 AllowwOverride None 则会完全忽略 .htaccess 文件,自然其中所定义的 rewrite 规则也就不能生效了。
最后,别忘了使用下列指令来重启 Apache:
sudo /etc/init.d/apache2 restart.
相关文章推荐
- 继续摘抄:Ubuntu系统启用Apache Mod_rewrite模块
- Ubuntu系统启用Apache Mod_rewrite模块
- Ubuntu系统启用Apache Mod_rewrite模块
- Ubuntu系统启用Apache Mod_rewrite模块
- Ubuntu系统下允许Apache的mod_rewrite功能
- ubuntu启用apache的mod_headers和mod_expires
- Ubuntu系统下允许Apache的mod_rewrite功能
- Ubuntu Apache配置及开启mod_rewrite模块
- Ubuntu系统启用Apache Mod_rewrite模块
- 启用Apache Mod_rewrite模块
- windows开启Apache的mod_rewrite模块
- ubuntu下配置django+apache+mysql+mod_python+Python
- 为apache启用页面压缩mod_deflate
- Webpy + Apache with mod_wsgi on Ubuntu http://webpy.org/cookbook/mod_wsgi-apache-ubuntu
- ubuntu下安装apache2.2+mod_wsgi+django(一)
- ubuntu16.04安装配置mod_python,apxs,apache
- Ubuntu 12.04 Precise LTS: Install ModSecurity for Apache 2 web server
- Python3.5 Django1.8 apache2.4 Ubuntu 配置mod_wsgi模块
- 为apache启用页面压缩mod_deflate
- 电脑装多系统,启动出现grub rescue,“normal.mod not found”解决办法(windows,ubuntu)