在.htaccess中设置是这样的
# 将 RewriteEngine 模式打开
RewriteEngine On# Rewrite 定义各重写规则
RewriteRule ^([0-9]+)$ index.php/Show/index/roomnum/$1/在浏览器中输入地址http://localhost/1704013154显示404错误,打不开网页
在浏览器中输入地址http://localhost/index.php/Show/index/roomnum/1704013154却能打开,请问是怎么回事了?

解决方案 »

  1.   

    重写规则要写在 <IfModule mod_rewrite.c> 节中
    贴全你的 .htaccess 文件
      

  2.   

    <IfModule mod_rewrite.c> </IfModule>
    在哪里?没有当然不行!
      

  3.   

    IfModule命令用于判断Apache是否安装了mod_rewrite模块,之后笔者会省略该命令,但不代表这是个好习惯。
      

  4.   

    加上IfModule网站都打不开了,500内部服务器错误
      

  5.   

    试试<IfModule mod_rewrite.c>
    RewriteEngine On
    # Rewrite 定义各重写规则
    RewriteRule ^([0-9]+)$ index.php?abc=$1
    </IfModule>
      

  6.   

    不行,还是Internal Server Error
      

  7.   

    RewriteRule ^([0-9]+)$ /项目名称/index.php?abc=$1试试
      

  8.   

    你是否没有启用.htaccess?
    6楼rewrite测试过是可行的。AllowOverride none 表示关闭.htaccess,如要开启可设置为AllowOverride all
      

  9.   

    原来是php的版本不一样的原因,版本不 一样处理方式不一样
      

  10.   

    可能吗?深表怀疑是改完没有restart Apache
      

  11.   

    这个伪静态规则,我也搞不太清楚,我们公司用的一个官网后台程序也是PHP的叫友点CMS系统,更换服务器这个就不支持伪静态了,.htaccess文件中的代码是这样的
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.bmp)$
    RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
    RewriteRule ^(.*)App/Tpl/(.+).html$  / [NC,F]
    </IfModule>