apache开启rewrite重写
命令开启
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
即可开启重写,不行的话再试下下面方法
ubuntu如何开启Rewrite模块
在终端输入:
sudo a2enmod rewrite 开启Rewrite模块(停用模块,使用 a2dismod)
sudo gedit /etc/apache2/sites-available/default 修改下面的地方
<Directory />
Options FollowSymLinks
AllowOverride None(修改为AllowOverride All)
</Directory>
<Directory "/var/orioner">
Options Indexes FollowSymLinks MultiViews
AllowOverride None(修改为AllowOverride All)
Order allow,deny
allow from all
</Directory>
最后sudo /etc/init.d/apache2 restart。
----------------------------------------------------
在网站下面建立.htaccess文件
修改.htaccess文件属性 chmod -R 777 .htaccess
Windows如何开启Rewrite模块
环境:
系统 Windows
Apache 2.2
加载Rewrite模块:
在conf目录下httpd.conf中找到
LoadModule rewrite_module modules/mod_rewrite.so
这句,去掉前边的注释符号“#”,或添加这句。
允许在任何目录中使用“.htaccess”文件,将“AllowOverride”改成“All”(默认为“None”):
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
在Windows系统下不能直接建立“.htaccess”文件,可以在命令行下使用“echo a> .htaccess”建立,然后使用记事本编辑。
CentOs开启Apache的rewrite_module
centos的配置文件放在: /etc/httpd/conf/httpd.conf
打开文件找到:
LoadModule rewrite_module modules/mod_rewrite.so
将前面"#"去掉,如果不存在则添加上句。
如果你的网站是根目录的话:找到
| 代码如下 | 复制代码 |
|
<Directory /> |
|
将上面的None改为All
如果你的站点不在根目录,设置如下:
| 代码如下 | 复制代码 |
|
<Directory "/var/www/html/my_directory"> Order allow,deny |
|
OK,然后重启服务器,service httpd restart ,这样.htaccess就可以使用了。
apache开启rewrite重写的更多相关文章
- 【转】CentOs中Apache开启rewrite模块详解
rewrite是apache环境的一个伪静态功能了,如果我们没有没让Apache开启rewrite功能,网站上所有的rewrite规则都不可使用. centos的配置文件放在: /etc/httpd/ ...
- Ubuntu 中 apache 开启 rewrite 模块
ubuntu14.04中安装好apache2.4之后默认rewrite模块是不开启的,项目public目录下的.htaccess文件就用不了,在浏览器中访问网页总是报500错误,原因就是这个. 执行下 ...
- CentOS下Apache开启Rewrite功能
1.centos的配置文件放在: /etc/httpd/conf/httpd.conf 打开文件找到: LoadModule rewrite_module modules/mod_rewrite.so ...
- Apache开启Rewrite伪静态
环境:Windows 2003 Apache 2.2 加载Rewrite模块 在conf目录下httpd.conf中找到 去掉# LoadModule rewrite_module modules/m ...
- centos7 Apache开启URL重写组件并配置.htaccess实现伪静态
第一.修改httpd.conf文件 A - 在etc/httpd/conf/目录下的httpd.conf 文件,找到: LoadModule rewrite_module modules/mod_re ...
- Apache开启rewrite
1.找到LoadModule rewrite_module modules/mod_rewrite.so去掉前面的#号 2.找到AllowOverride None 改为:AllowOverride ...
- windows apache开启url rewrite
加载Rewrite模块: 在conf目录下httpd.conf中找到 LoadModule rewrite_module modules/mod_rewrite.so 这句,去掉前边的注释符号“#”, ...
- apache开启重写模式
现在的好多的框架都使用有路由机制,但是如果在apache下,没有开启重写模式,服务器不会读取路由 所以今天要分享一下apache开启重写模式 ubuntu下: 1.在命令行下 sudo a2enmod ...
- nginx 隐藏index.php 并开启rewrite日志调试(apache也有)
开启rewrite 日志 error_log /data/log/nginx/error.log notice; 位于最外层,大约在文件的前几行 再在http{}括号里增加一行:rewri ...
随机推荐
- 快排java实现
package sort; public class QuickSort { public static final int cutoff = 3; /** * insertion sort * * ...
- android-Spinner的学习和使用
Spinner下拉列表的使用和功能 执行步骤: * 1.添加一个下拉列表项的list * 2.为下拉列表定义一个数组适配器(ArrayAdapter),添加数据资源 * 3.位适配器设置下拉列表下拉时 ...
- 状态压缩 DP
D - Hie with the Pie Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:65536 ...
- bootstrap input框清空
<!DOCTYPE HTML> <html> <head> <link href="http://netdna.bootstrapcdn.com/t ...
- MySQL配置文件改变了datadir值
从Noinstall Zip Archive中安装MySQL正在从Noinstall软件包安装MySQL的用户可以使用这个说明来手动安装MySQL.从Zip archive 中安装MySQL的 步骤如 ...
- 【iCore3 双核心板_ uC/OS-III】例程七:信号量——任务同步
实验指导书及代码包下载: http://pan.baidu.com/s/1kVjeN2n iCore3 购买链接: https://item.taobao.com/item.htm?id=524229 ...
- 分割excel sheet
Sub split_sheet() '输入用户想要拆分的工作表 Dim sheet_name sheet_name = Application.InputBox("请输入拆分工作表的名称:& ...
- 11高级网站构建:div和span
用<div>元素把属于一个逻辑部分的元素包围起来.可以用id属性为<div>提供一个唯一的标签. <div>的作用:1.更深一步展示页面的基本逻辑结构(相当于一个逻 ...
- 生成器(generator)内部解析
#http://kb.cnblogs.com/page/87128/(未看完)
- python学习之 字符串前'r'的用法
在打开文件的时候open(r'c:\....') 加r和不加''r是有区别的 'r'是防止字符转义的 如果路径中出现'\t'的话 不加r的话\t就会被转义 而加了'r'之后'\t'就能保留原有的样子 ...