[英]page not found after index.php removed
我想从我的网站上删除index.php
。 我尝试了以下步骤,但仍无法正常工作:
$config[index_page] = '';
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase/seotutor/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
尝试这个:
步骤:-1打开文件夹“ application / config”,然后打开文件“ config.php”。 在config.php文件中找到并替换以下代码。
//find the below code
$config['index_page'] = "index.php"
//replace with the below code
$config['index_page'] = ""
步骤:-2转到您的CodeIgniter文件夹并创建.htaccess
Path:
Your_website_folder/
application/
assets/
system/
.htaccess <——— this file
index.php
步骤:-3在.htaccess文件中编写以下代码
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
步骤:-4在某些情况下,uri_protocol的默认设置无法正常工作。 要解决此问题,只需打开文件“ application / config / config.php”,然后查找并替换以下代码
//find the below code
$config['uri_protocol'] = "AUTO"
//replace with the below code
$config['uri_protocol'] = "REQUEST_URI"
这将为您提供帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.