命令开启

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 />

  Options FollowSymLinks

  AllowOverride None 

</Directory>

将上面的None改为All

如果你的站点不在根目录,设置如下:

 代码如下 复制代码

<Directory "/var/www/html/my_directory">

Order allow,deny

Allow from all

AllowOverride All

</Directory>

OK,然后重启服务器,service httpd restart ,这样.htaccess就可以使用了。

apache开启rewrite重写的更多相关文章

  1. 【转】CentOs中Apache开启rewrite模块详解

    rewrite是apache环境的一个伪静态功能了,如果我们没有没让Apache开启rewrite功能,网站上所有的rewrite规则都不可使用. centos的配置文件放在: /etc/httpd/ ...

  2. Ubuntu 中 apache 开启 rewrite 模块

    ubuntu14.04中安装好apache2.4之后默认rewrite模块是不开启的,项目public目录下的.htaccess文件就用不了,在浏览器中访问网页总是报500错误,原因就是这个. 执行下 ...

  3. CentOS下Apache开启Rewrite功能

    1.centos的配置文件放在: /etc/httpd/conf/httpd.conf 打开文件找到: LoadModule rewrite_module modules/mod_rewrite.so ...

  4. Apache开启Rewrite伪静态

    环境:Windows 2003 Apache 2.2 加载Rewrite模块 在conf目录下httpd.conf中找到 去掉# LoadModule rewrite_module modules/m ...

  5. centos7 Apache开启URL重写组件并配置.htaccess实现伪静态

    第一.修改httpd.conf文件 A - 在etc/httpd/conf/目录下的httpd.conf 文件,找到: LoadModule rewrite_module modules/mod_re ...

  6. Apache开启rewrite

    1.找到LoadModule rewrite_module modules/mod_rewrite.so去掉前面的#号 2.找到AllowOverride None 改为:AllowOverride ...

  7. windows apache开启url rewrite

    加载Rewrite模块: 在conf目录下httpd.conf中找到 LoadModule rewrite_module modules/mod_rewrite.so 这句,去掉前边的注释符号“#”, ...

  8. apache开启重写模式

    现在的好多的框架都使用有路由机制,但是如果在apache下,没有开启重写模式,服务器不会读取路由 所以今天要分享一下apache开启重写模式 ubuntu下: 1.在命令行下 sudo a2enmod ...

  9. nginx 隐藏index.php 并开启rewrite日志调试(apache也有)

    开启rewrite 日志 error_log       /data/log/nginx/error.log notice; 位于最外层,大约在文件的前几行 再在http{}括号里增加一行:rewri ...

随机推荐

  1. bootstrap使用性能问题

    1.如icheckbox等的初始化,不要采用类似for in的循环来对所需应用的元素进行初始化,直接采用如  $('[data-toggle="popover"]').popove ...

  2. sql语句左右表连接理解

    一句话,左连接where只影响坐标,右连接where只影响右表

  3. demo工程的清单文件及activity中api代码简单示例

    第一步注册一个账户,并创建一个应用.获取app ID与 app Key. 第二步下载sdk 第三步新建工程,修改清单文件,导入相关的sdk文件及调用相应的api搞定. 3.1 修改清单文件,主要是加入 ...

  4. Web前端开发基础 第四课(盒代码模型)

    盒模型代码简写 还记得在讲盒模型时外边距(margin).内边距(padding)和边框(border)设置上下左右四个方向的边距是按照顺时针方向设置的:上右下左.具体应用在margin和paddin ...

  5. 【iCore3 双核心板】例程十一:DMA实验——存储器到存储器的传输

    实验指导书及代码包下载: http://pan.baidu.com/s/1bcY5JK iCore3 购买链接: https://item.taobao.com/item.htm?id=5242294 ...

  6. 【iCore3 双核心板】例程二十四:LAN_DHCP实验——动态分配IP地址

    实验指导书及代码包下载: http://pan.baidu.com/s/1i4vMMv7 iCore3 购买链接: https://item.taobao.com/item.htm?id=524229 ...

  7. js中的text(),html() ,val()的区别

    js中的text(),html() ,val()的区别 text(),html() ,val()三个方法用于html元素的存值和取值,但是他们各有特点,text()用于html元素文本内容的存取,ht ...

  8. Eclemma各种安装方式以及安装失败解决

    在线安装方法一: 在eclipse的菜单栏点击 Help -> Install New Software -> add Name:eclemma (名称可以随便填) Location:ht ...

  9. KeyValuePair

    KeyValuePair用法(转)(2012-06-25 10:47:35) 转载▼ // 标签: keyvaluepair it   KeyValuePair C# KeyValuePair< ...

  10. Error Domain=NSOSStatusErrorDomain Code=1718449215 "The operation couldn’t be completed. (OSStatus error 1718449215.)"

    是在录音时,recoreder的录音格式不对.