当前位置:  开发笔记 > 编程语言 > 正文

.htaccess已被读取,但重写网址无法正常工作

如何解决《.htaccess已被读取,但重写网址无法正常工作》经验,为你挑选了1个好方法。

httpd.conf中用于重写的模块如下:

LoadModule rewrite_module modules/mod_rewrite.so

.htaccess的路径:

c:\wamp\www\magentodev\.htaccess

因此在.htacess我有这个:



    Options +FollowSymLinks
    RewriteEngine on

    RewriteCond %{REQUEST_URI} ^/boombottleh2o\+?$
    RewriteRule (.*) /gu/boombottleh2o.php [NC,L,QSA]

//some other ones


我期待尝试:

localhost/magentodev/boombottleh2o

代替:

localhost/magentodev/gu/boombottleh2o.php

它应该工作,因为它正在生产但不是localhost,我有wamp服务器apache,这里有一些配置:

在C:\ wamp\bin\apache\apache2.4.9\conf\httpd.conf中:


    Options Indexes FollowSymLinks
    AllowOverride All
    Require local

这是不正确的,因为Anu说,所以我在C:\ wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf中更改为:


Options All
AllowOverride All
Order allow,deny
Allow from all



ServerAdmin localhost
DocumentRoot C:/wamp/www/
ServerName localhost

我无法弄清楚出了什么问题,我感谢任何帮助



1> anubhava..:

C:/wamp/www/magentodev/.htaccess喜欢这个:

ErrorDocument 404 default
Options +FollowSymLinks
RewriteEngine on

RewriteRule ^boombottleh2o(/.*)?$ gu/boombottleh2o.php [NC,L]

mod_rewrite 参考文献:

Apache mod_rewrite简介

Apache mod_rewrite技术细节

Apache mod_rewrite深入细节

Apache mod_rewrite初学者的教程

推荐阅读
大大炮
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有