.htaccess redirect subdomain*domain*come to another domain with the same parameters

echoniner's Avatar, Join Date: Oct 2010
Light Poster
I am pretty novice when it comes to hard .htaccess mods, so I beg of your help to do the following:

I want to redirect every call to any page from one subdomain*domain*come to another with the same parameters. This forum won't let me post my question here though, stating "Too many live links/images found in your post content. Please edit your post or contact the administrator." Annoying

So, I attached it as a text file...
Attached Files
File Type: txt question.txt (904 Bytes, 9 views)
echoniner's Avatar, Join Date: Oct 2010
Light Poster
The basic gist (if this forum allows me to post more "links"... we'll see): is:

I am looking for .htaccess code so that

subdomain.olddomain.com/index.php?many_variables_here

permanently redirects to (with the addressbar in the browser reflecting the new)

subdomain.NEWdomain.com/index.php?many_variables_here

thanks
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
We have the answer in the SEO FAQ's thread but I will post it once again here as well.

I just changed my domain name. How can I switch without losing my rankings?
Code:
 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^(www\.)?old-domain\.com$ [NC]
 RewriteRule ^(.*)$ http://www.new-domain.com/$1 [R=301,L]
I hope it helps.

Also regarding links new user with post counts less than 10 are not allowed to links to keep the spammers away and I hope you will understand this.
echoniner's Avatar, Join Date: Oct 2010
Light Poster
Thanks shabbir, but that does not work for me (just tried it).

My reply is in another text file, attached, as your spam check is too good. This is a coding forum, and I have no way to put url examples... i wish i knew what was triggering it...

The key is that I need subdomain (not w w w) * domain * com slash parameters



to forward to



subdomain (not w w w) * NEWdomain * com slash parameters



BUT: note that I only want that specific subdomain to forward. I do not want the w w w * olddomain to forward, just that subdomain.



Thanks!







PS: For what its worth, I tried your code exactly, just exchanging my real domain names with "old-domain" and "new-domain" and got no results. I expected with the (www\) I would've redirected everything, but it is not. At least my browswer addressbar does not change to the new domain.
Attached Files
File Type: txt question 2.txt (626 Bytes, 6 views)

Last edited by shabbir; 22Oct2010 at 07:46.. Reason: Attachment Content
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
The trigger is http and www.

Now to answer your question www is also a subdomain of your domain.com
echoniner's Avatar, Join Date: Oct 2010
Light Poster
thanks for the clarification.

On the code you posted above: why does it not work for me with parameters?

can you break down the code... what is each part doing? maybe if I better understood this, I could understand why it isn't working. Thanks!
echoniner's Avatar, Join Date: Oct 2010
Light Poster
Here's my solution: website: webmasterworld.com/apache/4220225.htm