我试图让网址
http://127.0.0.1/dev/blog/welcome
但是当我键入它改变了网址 http://127.0.0.1/开发/博客/ index.php文件/欢迎
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
但是当我做的http://127.0.01/dev/blog//welcome
它保持这样出于某种原因,
But When I do http://127.0.01/dev/blog//welcome
it stays like that for some reason.
我的.htaccess是
my .htaccess is
RewriteEngine On
RewriteBase /dev/blog
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index.php|images|robots.txt|css)
RewriteRule ^(.*)$ index.php?/$1 [L]
和我的config.php配置
and my config.php is configured
$config['base_url'] = 'http://127.0.0.1/dev/blog/';
$config['index_page'] = '';
呵呵,我也检查mod_rewrite的是,我使用WAMP
Oh, and I did check if mod_rewrite is on and I'm using WAMP
另一个信息:我使用的是Firefox,但是当我使用IE浏览器(9)它不会改变从网址
http://127.0.0.1/dev/blog/welcome
到 http://127.0.0.1/dev/blog/index.php/welcome
Another info: I'm using Firefox but when I use IE(9) It doesn't change the url from
http://127.0.0.1/dev/blog/welcome
to http://127.0.0.1/dev/blog/index.php/welcome
有关你的重写规则
,添加NC和QSA标志。该QSA确保查询字符串追加。除非你打算codeIgniter管理你的CSS文件,图像和robots.txt的,离开了倒数第二行了。
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.
试试这个:
RewriteEngine On
RewriteBase /dev/blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]
另外,检查你的 uri_protocol
在config.php。我有一些问题,WAMP没有检测到它正确,并且有最幸运用它设置而不是 AUTO 。
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
.