RewriteEngine on
RewriteBase /
RewriteRule ^city/([a-zA-Z0-9\-\(\)]+)$ city.php?id=$1上面这写法,www.xxx.com/city/boston应该变成www.xxx.com/city.php?id=boston
可以进入city.php这个页面,但读不了id参数,为什么?
后来我干脆把RewriteRule ^city/([a-zA-Z0-9\-\(\)]+)$ city.php?id=$1删除了,奇怪的是还起作用,这样city/boston还会进入city.php页面,为什么?RewriteRule我都删除了,怎么还这样?难道使用过一次就永远起作用的吗?怎么搞?

解决方案 »

  1.   

    我改成这样一个不存在的ababab.php网页
    RewriteRule ^city/([a-zA-Z0-9\-\(\)]+)$ ababab.php?id=$1
    还会进入city.php页面,为什么这样啊,崩溃啊
      

  2.   

    我要怎么样使之前用过的现在已删除的RewriteRule不再起作用?
      

  3.   

    重启 Apache 应该能管用吧,否则就是灵异事件了。可以开启 rewrite log,看看到底发生了什么。
      RewriteLog logs/rewrite.log
      RewriteLogLevel 9
    ————————————————————————————————
    基于CSDN论坛提供的插件扩展功能,自己做了个签名档工具,分享给大家,欢迎技术交流 :)
      

  4.   

    我也认为重启apache或者你的iis应该可以,再不然重启电脑。
      

  5.   

    我也想重启,刚才一直找apache路径,没找到,不知道怎么找,是别人安装的,以前别的服务器都在/usr/local/apache/bin/apachectl下,但这个没有
      

  6.   


    root@u008:~# /usr/local/apache/bin/apachectl stop   
    -bash: /usr/local/apache/bin/apachectl: No such file or directory
    root@u008:~# /etc/apache2/bin/apachectl stop 
    -bash: /etc/apache2/bin/apachectl: No such file or directory
    root@u008:~# /usr/local/apache2/bin/apachectl stop
    -bash: /usr/local/apache2/bin/apachectl: No such file or directory
    root@u008:~# apachectl -v
    -bash: apachectl: command not found
    root@u008:~# apachectl -c
    -bash: apachectl: command not found
    root@u008:~# apachectl --c
    -bash: apachectl: command not found
    root@u008:~# rpm -q httpd
    -bash: rpm: command not found
    root@u008:~# rpm -q      
    -bash: rpm: command not found
    root@u008:~# 
    root@u008:~# ps -e | grep httpd
    root@u008:~# 
    root@u008:~# ps -e | grep httpd
    root@u008:~# 
    root@u008:~# ps -e | grep httpd
    root@u008:~# ps -ef|grep httpd
    root     13021 12744  0 13:34 pts/0    00:00:00 grep httpd
    root@u008:~# ps -e|grep httpd
    root@u008:~# 你们看我搞一通后什么都没得到
      

  7.   


    后来我干脆把RewriteRule ^city/([a-zA-Z0-9\-\(\)]+)$ city.php?id=$1删除了,奇怪的是还起作用,这样city/boston还会进入city.php页面,为什么?RewriteRule我都删除了,怎么还这样?难道使用过一次就永远起作用的吗?怎么搞?起作用是因为没有重启WEB服务器,对于.htaccess文件的修改,要生效必须要重启WEB服务器
      

  8.   

    无后缀的URL重写需要进行一些处理,你先试一下加个.php后缀能读取到参数不:RewriteRule ^city/([a-zA-Z0-9\-\(\)]+)\.php$ city.php?id=$1
      

  9.   

    我就是这个问题,写上函数apache启动不起来,但如果写RewriteEngine on  apache就能启动,写上Rewriterule 就不好使,不知道你的是什么版本,
    我下的是2.2.17,可能是版本比较新?