Albiréo
Albiréo

Reputation: 133

CodeIgniter - Routing doesn't work

I have a routing problem in CodeIgniter.

I can access to my default controller (the login page) with the http://localhost/MySite. So I think the routing configuration is good.

When I submit the login form of my login page, I get a Not found error 404 and the URL displayed is http://localhost/MySite/login?

When I insert "index.php" (http://localhost/MySite/index.php/login) in the url, it works. In the documentation it's written that I must add some lines in .htaccess:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

What is wrong with this URL Routing?

Upvotes: 2

Views: 563

Answers (2)

Hasib Tarafder
Hasib Tarafder

Reputation: 5813

Please try this..

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

I hope it will be ok.

Upvotes: 1

Venkata Krishna
Venkata Krishna

Reputation: 4305

Try this thing which i am using write now in my project........

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Upvotes: 2

Related Questions