CodeIgniter使用.htaccess文件删除index.php [英] CodeIgniter Removing index.php using .htaccess file
问题描述
使用.htaccess文件在CodeIgniter中删除index.php对我不起作用。我尝试下面的代码eventhough不工作。
< IfModule mod_rewrite.c&
RewriteEngine on
RewriteBase /
RewriteCond $ 1!^(index\.php | resources | robots\.txt)
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteRule ^(。*)$ /index.php?/$1 [L,QSA]
< / IfModule>
我试过这个 http://firstcode.info/codeigniter-removing-index-php-from-url/ 。但不工作。但它的工作在我的本地主机。我也编辑了httpd.config文件。但关闭不使用。
请帮助我。
STEP 1
打开文件夹application / config
,然后打开文件config.php。
找到并替换 config.php文件中的以下代码。
em>
$ config ['index_page'] =index.php
以下代码
$ config ['index_page'] =
STEP 2
p $ p>
< IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteRule ^(。*)$ index.php / $ 1 [L,QSA]
< / IfModule>
b $ b
STEP 3
application / config / config.php,
,然后查找并替换以下代码
<$> p $ p>
$ config ['uri_protocol'] =AUTO
替换以下代码
$ config ['uri_protocol'] = REQUEST_URI
Removing index.php in CodeIgniter using .htaccess file is not working for me. I Tried following code eventhough not working.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]
</IfModule>
I tried this http://firstcode.info/codeigniter-removing-index-php-from-url/. But not working.But its working in my localhost. I also edited httpd.config file.But off no use. Please help me.
STEP 1
Open the folder "application/config"
and open the file "config.php".
find and replace the below code in config.php file.
find the below code
$config['index_page'] = "index.php"
replace with the below code
$config['index_page'] = "
STEP 2
Write below code in .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
STEP 3
"application/config/config.php",
then find and replace the below code
find the below code
$config['uri_protocol'] = "AUTO"
replace with the below code
$config['uri_protocol'] = "REQUEST_URI"
这篇关于CodeIgniter使用.htaccess文件删除index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!