CodeIgniter htaccess mod_rewrite not working properly

前端 未结 3 859
灰色年华
灰色年华 2021-01-07 03:15

I\'m trying to make the url into http://127.0.0.1/dev/blog/welcome but when I type that it changes the url to http://127.0.0.1/dev/blog/index.php/welcome<

相关标签:
3条回答
  • 2021-01-07 04:02

    Do you have set AcceptPathInfo to ON in your apache configuration?

    0 讨论(0)
  • 2021-01-07 04:05

    For your RewriteRule, add the NC and QSA flags. The QSA ensures that query strings are appended. Unless you are planning on CodeIgniter manage your css files, images, and robots.txt, leave out the penultimate line too.

    Try this:

    RewriteEngine On
    RewriteBase /dev/blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]
    

    Also, check your uri_protocol in config.php. I've had some problems with WAMP not detecting it properly, and have had the most luck with setting it to PATH_INFO instead of AUTO.

    0 讨论(0)
  • 2021-01-07 04:13

    Make sure you are editing the file on your webroot dir and not on the application dir. I've struggled a little bit while trying to get this to work properly until I finally figured that was my problem

    0 讨论(0)
提交回复
热议问题