senthil kumaran
senthil kumaran

Reputation: 1

CodeIgniter URL rewrite not working

I am trying to redirect url in CodeIgniter framework with www.hostname.com/crm/some/url to www.hostname.com/index.php?/some/url

I wrote following rule in my .htacess

RewriteEngine on
RewriteRule ^crm(.*)$ index.php?/$1     [L]

When i try this in browser, i get page not found 404 from codeIngnitor. But if add [R] flag in the redirect rules, it works proper and i could see the new url as expected after the change.

I tried apache rewrite log. Everything looks proper. I have no what URL the CodeIgniter frame sees after rewrite. Any help is appreciated.

Upvotes: 0

Views: 332

Answers (2)

kishan Radadiya
kishan Radadiya

Reputation: 832

You can follow this, Do this code copy and paste in your .htaccess file. I think it will help you.

RewriteEngine on
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|uploads|themes|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

Upvotes: 0

kchason
kchason

Reputation: 2885

Is there a reason you're not using the typical Codeigniter .htaccess?

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

Upvotes: 1

Related Questions