Jump to content

Recommended Posts

We have an mod_rewrite board here that would have been a more suitable place to post.

 

Anyway, something like this within your doc root should do it.

 

RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com [NC]
RewriteRule ^(.*)$ http://forum.mysite.com/$1 [R=301,L]

 

Sorry about that, didn't see it :)

 

Now would that redirect something like 'http://mysite.com/sjidsdijg' to 'http://forum.mysite.com/sjidsdijg'?

Yep.

 

Thanks alot!

 

Sorry for one last thing..

 

I want it so if they go straight to http://mysite.com, redirect them to http://blog.mysite.com.. If they go to ANYTHING other than just http://mysite.com, redirect them to http://forum.mysite.com..

 

 

 

Examples:

http://mysite.com - http://blog.mysite.com

http://mysite.com/4946 - http://forum.mysite.com/4946

http://blog.mysite.com/index.php - NO CHANGE

 

I hope that's possible ;)

I tried learning .htaccess for the past week now and it's just confusing to me.. I'm sorry for not learning..

 

You should be able to quickly figure out how to do this your self x.x.

 

 

Anyway:

 

 

RewriteRule ^$ http://blog.blah.com/ [R=301,L]

RewriteRule (.*) http://forum.blah.com/$1 [QSA,R=301]

 

That brings me to http://forum.mysite.com/_forum/_forum/_forum/_forum/_forum/_forum/_forum/_forum/_forum/_forum/_forum/

 

And same for blog..

 

It seems to be redirecting even when already in the subdomain..

It would sound then like it's going into an infinite loop because your forum subdomain is being affected by the same htaccess file.

 

 

(The blog one is probably also loop infinitely but it's probably not as apparent since it will still work correctly.)

 

 

So basically you can either stop the RewriteRule from affecting the forum/blog folders by over riding it, or you can put a condition in there.

 

 

(The condition is borrowed from thorpe)

 

RewriteCond %{HTTP_HOST} ^(www\.)?blah\.com [NC]

RewriteRule ^$ http://blog.blah.com/ [R=301,L]

RewriteRule (.*) http://forum.blah.com/$1 [QSA,R=301]

It would sound then like it's going into an infinite loop because your forum subdomain is being affected by the same htaccess file.

 

 

(The blog one is probably also loop infinitely but it's probably not as apparent since it will still work correctly.)

 

 

So basically you can either stop the RewriteRule from affecting the forum/blog folders by over riding it, or you can put a condition in there.

 

 

(The condition is borrowed from thorpe)

 

RewriteCond %{HTTP_HOST} ^(www\.)?blah\.com [NC]

RewriteRule ^$ http://blog.blah.com/ [R=301,L]

RewriteRule (.*) http://forum.blah.com/$1 [QSA,R=301]

 

I'm sorry but it still does the same thing..

Oh, you might actually need the Cond twice:

 

 

RewriteCond %{HTTP_HOST} ^(www\.)?blah\.com [NC]

RewriteRule ^$ http://blog.blah.com/ [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?blah\.com [NC]

RewriteRule (.*) http://forum.blah.com/$1 [QSA,R=301]

 

Thank you so much, that works perfectly ;)

 

I'm sorry for any trouble..

 

/solved

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.