Codeigniter URL不工作没有index.php [英] Codeigniter URL not working without index.php
问题描述
我刚刚设置了一个新的webiste http://www.reviewongadgets.com
I've just set up a new webiste http://www.reviewongadgets.com
但是有一个URL渲染的问题
But there is a problem with URL rendering
当我把一个URL下面它不工作,给出页面未找到错误
http://www.reviewsongadgets.com/latest-mobile
When I put an URL as below it's not working and gives page not found error http://www.reviewongadgets.com/latest-mobile
但它适用于
http: //www.reviewongadgets.com/index.php/latest-mobile
我不想在我的网址中显示index.php,请 http://www.reviewongadgets.com/latest-mobile
,您能请建议我该怎么办?
I don't want to show index.php in my URL, it should be http://www.reviewongadgets.com/latest-mobile , can you please suggest me what should I do ?
这是我的 .htaccess
文件内容:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
配置文件内容:
$config['base_url'] = "http://www.reviewongadgets.com";
$config['index_page'] = "";
相同类型的配置适用于我的另一个网站
Same type configuration working for my another website
将我的 .htaccess
更改为
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
推荐答案
这个问题最常见的解决方法是缺少 .htaccess
中的index.php后面的问号?
,所以
The most common solution to this problem is usually the missing question mark ?
after index.php in .htaccess
, so
RewriteRule ^(.*)$ index.php/$1 [L]
b $ b
应为
should be
RewriteRule ^(.*)$ index.php?/$1 [L]
EG在我的Windows XAMPP上,我不需要?,但在Linux托管环境中通常需要它。
E.G. on my Windows XAMPP, I do not need the "?", but in a Linux hosting environment it is usually required.
这篇关于Codeigniter URL不工作没有index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!