Welcome Guest, Not a member yet? Register   Sign In
mod_rewrite url redirect problem
#1

[eluser]freaksauce[/eluser]
I have the following set up to remove the index.php and its working fine:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt|images|css|js|swfs|tmp)
RewriteRule ^(.*)$ /index.php/$1 [L]
However we now want to redirect 'http://www' to just 'http://' keeping any directories or pages in the url like this:
Code:
RewriteCond %{HTTP_HOST} ^www.mysite.com$ [NC]
RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
The only problem is that when it rewrites the url includes the '/index.php/' included (like this: http://mysite.com/index.php/category) which is messing up the clients tracking data. Is there a way of rewriting this in a different order?

The whole block is as follows:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt|images|css|js|swfs|tmp)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{HTTP_HOST} ^www.mysite.com$ [NC]
RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]


Messages In This Thread
mod_rewrite url redirect problem - by El Forum - 09-17-2007, 12:18 AM
mod_rewrite url redirect problem - by El Forum - 09-17-2007, 12:59 AM
mod_rewrite url redirect problem - by El Forum - 09-17-2007, 01:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB