Reputation: 1072
Options +FollowSymlinks
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|uploads|tt|application/modules/.*/assets|resources|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php?/$1 [L]
Redirect 301 /testurl /home/
This is my .htaccess
file for checking 301
redirection in my CodeIgniter project.
The 301
redirection works fine but problem is with the URL. When I try...
http://parcmobilenew.eworkdemo.com/testurl
...it redirects to Home Page as mentioned in .htaccess
but it takes requested URL in query string like this...
http://parcmobilenew.eworkdemo.com/home?/testurl
How can I make the .htaccess
not do this when redirecting?
Upvotes: 4
Views: 1123
Reputation: 785196
Redirect
rules with mod_alias
ones.You can use this code:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^testurl/?$ /home/? [L,NC,R=301]
RewriteCond $1 !^(index\.php|assets|uploads|tt|application/modules/.*/assets|resources|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]
Better to test in a new browser to avoid old 301 caches.
Upvotes: 3