解决方案 »

  1.   

    1.httpd.conf中rewrite模块是否正确开启
    2.你写入的这个配置文件是否有效
      

  2.   

    我在ubuntu下,没有发现httpd.conf文件,主配置文件只有apach2.conf,另外现在的配置是这样的.
    1.在/var/www/project/ShortURL目录下建立一个.htaccss文件内容如下: # Turn on rewrite engine
    Options +FollowSymlinks
    RewriteEngine on
    # More rules below
    RewriteRule ^index.php/(.*)$ index.php?controller=jump&method=jump&code=$1 [QSA2.在apach2.conf中做了如下配置: <Directory /var/www/project/ShortURL>
        Options FollowSymLinks
        AllowOverride ALL
        Require all granted
    </Directory>别的没有做配置.现在的问题是这样的:
    现在问题是每次输入http://localhost/project/ShortURL/index.php/149Ui3都会显示没有css样式控制的http://localhost/project/ShortURL/index.php内容(地址栏还是http://localhost/project/ShortURL/index.php/149Ui3),不能跳转到http://localhost/project/ShortURL/index.php?controller=jump&method=jemp&code=149Ui3这个地址 
      

  3.   

     问题解决了,总结一下:
    问题描述:
    我的目的是在地址栏输入的url:
    http://localhost/project/ShortURL/index.php/149Ui3
    自动重写为
    http://localhost/project/ShortURL/index.php?controller=jump&method=jump&code=149Ui3
    <b>解决方案</b>
    1.在apach2.conf中做如下配置: 
    <Directory /var/www/project/ShortURL>
        Options FollowSymLinks
        AllowOverride ALL
        Require all granted
    </Directory>
    2.在/var/www/project/ShortURL目录下建立一个.htaccss文件内容如下:    
    # Turn on rewrite engine                                                                        
    RewriteEngine on
    # More rules below
    RewriteBase /
    RewriteRule ^index.php/(.*)$ http://localhost/project/ShortURL/index.php?controller=jump&method=j    ump&code=$1 [L,R=301]
    <b>写在最后</b>
    没事的时候还得多看文档啊,感谢开源中国疯狂的蜗牛提供的思路.