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

301 redirect

Discussion in 'White Hat SEO' started by Ledlys, Jul 30, 2013.

  1. Ledlys

    Ledlys Regular Member

    Joined:
    Oct 3, 2011
    Messages:
    232
    Likes Received:
    0
    I'm looking to 301 redirect some of my pages to my main page using htaccess file.
    Today I have a redirect code without rewrite rule. Whats the different? I'm want the best seo way which I believe that is all pages of the other domain going to my money main domain, e.g http://www.hats.com/blackhats goes to http://www.hats.se

    Can anyone copy and past the code you're using?

    thanks!
     
  2. Ledlys

    Ledlys Regular Member

    Joined:
    Oct 3, 2011
    Messages:
    232
    Likes Received:
    0
    today I use this code:
    [FONT= ]
    Options +FollowSymLinks[/FONT]

    [FONT= ]RewriteEngine on[/FONT]
    [FONT= ]RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

    and now my http://www.domain.com/something redirects to http://www.domain.no/something. But I want all this /something to redirect directly to the new domains [/FONT]
    [FONT=Verdana, Arial]landing page. Any suggestions?[/FONT]
     
  3. gullsinn

    gullsinn Jr. VIP Jr. VIP Premium Member

    Joined:
    Dec 24, 2009
    Messages:
    2,429
    Likes Received:
    2,210
    Gender:
    Male
    Occupation:
    Jobless :D
    Location:
    Graveyard
    Home Page:
    You can simple use a plugin if you are using wordpress and also if you have cpanel hosting there is any url-redirection option your cpanel.
     
    • Thanks Thanks x 2
  4. Ledlys

    Ledlys Regular Member

    Joined:
    Oct 3, 2011
    Messages:
    232
    Likes Received:
    0
    Thanks, but I used to have a htaccess code doing this. Then my host created this redirect like you said, but then i creates http://www.hats.com/whatever to http://www.hats.net/whatever, and I do not have any hats.net/whatever making people going to a place that do not exist.

    Anyone have any htaccess code like this?
     
  5. Ledlys

    Ledlys Regular Member

    Joined:
    Oct 3, 2011
    Messages:
    232
    Likes Received:
    0
    anyone done this before?
     
  6. live1

    live1 Junior Member

    Joined:
    Dec 19, 2011
    Messages:
    182
    Likes Received:
    24
    if you just want your visitor to land on the page, you could edit your 404.php and redirect that to your money page :)
     
  7. Ledlys

    Ledlys Regular Member

    Joined:
    Oct 3, 2011
    Messages:
    232
    Likes Received:
    0
    Got it, now I use this:


    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.mydomain/ [R=301,L]
     
  8. Endire

    Endire Elite Member Premium Member

    Joined:
    Mar 27, 2012
    Messages:
    1,756
    Likes Received:
    1,061
    Gender:
    Male
    Ledlys,

    If the code you have is working fine for you that's great but you should really have a directive in there stating a condition in order for the redirect to happen. The proper way to write a redirect to another domain would be as follows,
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www.example.com$
    RewriteRule ^(.*)$ http://www.newexample.com/$1 [R=301,L]

    Note that you would only have the "L" in the brackets if it's the last rule.

    Best,

    Shawn