Ubuntu Apache 开启加载Rewrite 伪静态
2016-06-16 17:46
465 查看
开启加载Rewrite
执行下命令加载
然后建立软连接
编辑apache2.conf文件
sudo vi /etc/apache2/apache2.conf
找到 AllowOverride None 改成ALL
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride ALL
Require all granted
</Directory>
重启Apache
在网站根目录新建.htaccess文件,没有文件名,内容为以下内容。如果新建不了就下载附件。
执行下命令加载
a2enmod rewrite
然后建立软连接
ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
编辑apache2.conf文件
sudo vi /etc/apache2/apache2.conf
找到 AllowOverride None 改成ALL
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride ALL
Require all granted
</Directory>
重启Apache
/etc/init.d/apache2 restart
在网站根目录新建.htaccess文件,没有文件名,内容为以下内容。如果新建不了就下载附件。
AddDefaultCharset utf-8 Options +FollowSymLinks IndexIgnore */* RewriteEngine on # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it to index.php RewriteRule . index.php
相关文章推荐
- Ubuntu 默认壁纸历代记
- Ubuntu Remix Cinnamon 20.04 评测:Ubuntu 与 Cinnamon 的完美融合
- 关于Ubuntu 11.10启动提示waiting for the network configuration的问题
- 在 Ubuntu 桌面中使用文件和文件夹
- ubuntu下chrome无法同步问题解决
- Ubuntu Linux使用体验
- 使用 GNOME 优化工具自定义 Linux 桌面的 10 种方法
- 以Ubuntu 9.04为例 将工作环境迁移到 Linux
- VirtualBox虚拟机XP与宿主机Ubuntu互访共享文件夹
- 从USB安装Ubuntu Server 10.04.3 图文详解
- Ubuntu 15.04 正式版发布下载
- Linux-Ubuntu 10.04安装Cadence-ic610 方法总结图解
- Apache Isis 1.4.0 发布,领域驱动开发框架
- Ubuntu 12.04和Windows 7双系统安装图解
- Ubuntu /home下中文目录如何修改成英文?
- 开机出现:grub rescue的修复方法
- Ubuntu连接Android真机调试
- 你应该选择 Ubuntu 还是 Fedora?
- 100 个最佳 Ubuntu 应用(中)
- 看看我的Ubuntu Linux截图