我本地现在的文件路径是
http://localhost/eshop/index.php
http://localhost/eshop/lookinfo.php?id=57 现在我想把这2个地址给URL重写,因为是在本地,我是个初学者,不知道该怎么写?望高手多指教啊~

解决方案 »

  1.   

    这个我知道,apache我也配置好了,就是正则不知道该怎么写?
    而且
    http://localhost/eshop/index.php 
    http://localhost/eshop/lookinfo.php?id=57 
    这两个文件要是在服务器上,浏览器打开后显示的路径是什么样子的啊?
      

  2.   

    .htaccess文件里写RewriteRule ^eshop/index.html eshop/index.phpRewriteRule ^eshop/([0-9]+).html$ eshop/lookinfo.php?id=$1
      

  3.   

    http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_rewrite.html
      

  4.   

    url重写以前也没有做过!学习一下!
      

  5.   

    首先apache需要开启rewrite模块.htaccess普通文本文件改扩展名,然后在CMD里直接重命名改名,否则windows无法直接这样取名的。然后用记事本打开.htaccess:输入以下代码即可!
    RewriteRule ^eshop/index.html eshop/index.phpRewriteRule ^eshop/([0-9]+).html$ eshop/lookinfo.php?id=$1
      

  6.   

    不好意思修正一下:顶部分要多加一句才可以!
    RewriteEngine on
    RewriteRule ^eshop/index.html eshop/index.php
    RewriteRule ^eshop/([0-9]+).html$ eshop/lookinfo.php?id=$1
      

  7.   

    可以使用.htaccess进行URL重写
      

  8.   

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^id-(\d*).html$ lookinfo.php/$1