1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Search Engine Optimization (SEO)' started by echoniner, Oct 21, 2010.

  1. echoniner

    echoniner New Member

    Joined:
    Oct 21, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    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:

  2. echoniner

    echoniner New Member

    Joined:
    Oct 21, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Re: .htaccess redirect subdomain*domain*come to another domain with the same paramete

    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
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    Re: .htaccess redirect subdomain*domain*come to another domain with the same paramete

    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.
     
  4. echoniner

    echoniner New Member

    Joined:
    Oct 21, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Re: .htaccess redirect subdomain*domain*come to another domain with the same paramete

    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:

    Last edited by a moderator: Oct 22, 2010
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    Re: .htaccess redirect subdomain*domain*come to another domain with the same paramete

    The trigger is http and www.

    Now to answer your question www is also a subdomain of your domain.com
     
  6. echoniner

    echoniner New Member

    Joined:
    Oct 21, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Re: .htaccess redirect subdomain*domain*come to another domain with the same paramete

    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!
     
  7. echoniner

    echoniner New Member

    Joined:
    Oct 21, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Re: .htaccess redirect subdomain*domain*come to another domain with the same paramete

    Here's my solution: website: webmasterworld.com/apache/4220225.htm
     

Share This Page