【发布时间】:2014-06-18 06:58:43
【问题描述】:
我将代码放在 .htaccess 中是 htaccess 代码,并在 config.php 文件中进行了更改,但仍然出现 404 错误,请任何人帮我找出问题所在,听到的是网站的链接 http://198.12.149.211/~physrec/
$config['base_url'] = "http://198.12.149.211/~physrec/";
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ci_intro/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /ci_intro/index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /ci_intro/index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ci_intro/index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
【问题讨论】:
-
如果你想从你的 URL 中删除 index.php,那么请确保在 application/config/config.php - $config['index_page'] = '' 中执行以下操作
-
我只是把 $config['index_page'] = '' 但它仍然不工作
-
刚才我点击了上面的链接,页面正在打开,我没有收到404错误。
-
主页已打开,但其他菜单页面无法正常工作,出现 404
-
修改你的重写规则并从那里删除 /ci_intro/ ..例如你最后的重写规则应该是 - RewriteRule ^(.*)$ index.php?/$1 [L]
标签: php .htaccess codeigniter