Jump to content

Recommended Posts

Ok, I have two domains.

 

Let's say I want http://XXX.domainA.com to go to http://domainB.com/title-goes-here

 

How can I do that using mod_rewrite in the .htacess file for my domainA.com domain? Like, http://funny.domainA.com would then redirect to http://domainB.com/blog/the-title-of-something

 

I know I can create a subdomain on domainA and have a 301 redirect to go to another URL.

 

But I'm wondering if I can just use mod-rewrite for my domainA.com?

It's difficult to understand exactly what your trying to achieve as you have given very generalised statement and no specific example. You say http://funny.domainA.com would redirect to http://domainB.com/blog/the-title-of-something, but there is no correlation between the two URLs. For that reason a Redirect directive makes far more sense than using mod_rewrite. If you'd have said you wanted http://funny.domainA.com to redirect to http://domainB.com/blog/funny then I could understand using a RewriteRule.

Assuming http://funny.domainA.com/ actually arrives at the right place (not all servers have sub-domains enabled in that way), something like this should work...

 

RewriteCond {HTTP_HOST} !^www.domainA.com$ 
RewriteCond {HTTP_HOST} ^([a-zA-Z]+).domainA.com$
RewriteRule ^.*$ http://domainB.com/blog/%1

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.