简体   繁体   中英

Login url redirects to home page after hiding index.php using htaccess in codeigniter - [Codeigniter url redirection issue]

I am developing a shopping cart site using Codeigniter Gocart script. I hid index.php using htaccess. When I try to login using localhost/project143/secure/login , it works fine and goes to login page. But when I try the login link in live as hostname/projects/project143/secure/login , it redirects to home page instead of login page.The login page with index.php in the URL ( http://hostname/projects/project143/index.php/secure/login ) is opening login page well. I've attached the screenshot of my issue and redirection code for clarification. Anyone knows this issue and fix ?

.htaccess

    RewriteEngine on
    RewriteBase /projects/project143/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|assets|uploads|robots\.txt)
    RewriteRule ^(.*)$ index.php/$1 [L]

Home Page: 在此输入图像描述 Login Page with index.php included in URL: 在此输入图像描述 Login Page without index.php in the URL: 在此输入图像描述

Here it is solution How to remove "index.php" in codeigniter's path

Try user unicorn's answer.it will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM