如何从我的网址中删除index.php。我的域名没有停放我有重定向页面的问题。它显示404.我使用codeigniter。
我的显示网址:
http://example.com/index.php/crypto/dashboard
我需要这样:
http://example.com/crypto/dashboard
我的代码是:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
答案 0 :(得分:0)
RewriteEngine on
RewriteCond $1 !^(index.php|images|css|js|robots.txt|favicon.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
你在index.php之前缺少./
答案 1 :(得分:0)
**Uncomment** mod_rewrite.so in httpd.conf
#LoadModule rewrite_module modules/mod_rewrite.so
to
LoadModule rewrite_module modules/mod_rewrite.so
**create** .htaccess file on root app folder
with my example script
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /hrd/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
**codeigniter** config.php
set --- $config['index_page'] = 'index.php';
to --- $config['index_page'] = '';