CodeIgniter | .htaccess removing index.php from url

╄→гoц情女王★ 提交于 2019-12-01 04:07:29

Try defining the RewriteBase to /projects/zorkif_nextgen

RewriteBase /projects/zorkif_nextgen

this is works well for me:

1- create .htaccess file in the root folder with the following content

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

2- from the config file change $config['index_page'] = 'index.php'; to $config['index_page'] = '';

Try the following

RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

You can try this

<IfModule mod_rewrite.c> 
   RewriteEngine on 
   RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt) 
   RewriteRule ^(.*)$ /ci/index.php/$1 [L] 
</IfModule>

For future reading This will help you Codeigniter remove index php from url using htaccess

You may have look at config/routes.php.

It may have been set to a default controller.

Don't use an .htaccess file to remove index.php from your URLs. This is an issue in your config. Look specifically at $config['base_url'] and $config['index_page']

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!