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

[php] 301 redirect vs meta-refresh in header

Discussion in 'Black Hat SEO' started by SuperNoobInc, May 27, 2012.

  1. SuperNoobInc

    SuperNoobInc Regular Member

    Joined:
    Dec 28, 2011
    Messages:
    467
    Likes Received:
    32
    Hey all,

    Hope you guys can help me out with this.
    I am doing some offline advertising and created a special URL for tracking purpose; mydomain.com/offline

    The intention of this is to redirect the visitor to my product page automatically, while enabling me to track the # of visitors
    passing through this page via Google analytics.

    At this moment, I am using 301 redirect on the actual php page, but it doesnt seem to be tracking at all.
    Does that mean the visitors get redirected BEFORE analytics track them down?

    P.S: I have tried putting the 301-code AFTER Google Analytics code (javascript). But still no luck.

    Thanks in advance.
     
  2. SuperNoobInc

    SuperNoobInc Regular Member

    Joined:
    Dec 28, 2011
    Messages:
    467
    Likes Received:
    32
    Can someone please help me out on this. Thanks
     
  3. Abstroose

    Abstroose Elite Member

    Joined:
    Nov 20, 2008
    Messages:
    2,097
    Likes Received:
    3,475
    Occupation:
    Thai Boxer
    Location:
    UK
    Home Page:
    A 301 redirect is telling bots and crawlers that the webpage has permanently moved, so it's likely they are not reading the rest of the code. Try using a meta refresh instead:

    Code:
    <META HTTP-EQUIV="refresh" CONTENT="1; URL=http://www.newpage.com />
     
    • Thanks Thanks x 1
  4. SuperNoobInc

    SuperNoobInc Regular Member

    Joined:
    Dec 28, 2011
    Messages:
    467
    Likes Received:
    32
    Will this have any impact on my SERP etc.?
    I plan to do quite a few offline campaign and i will have a bunch of meta-refresh redriecting pages then?
     
  5. Abstroose

    Abstroose Elite Member

    Joined:
    Nov 20, 2008
    Messages:
    2,097
    Likes Received:
    3,475
    Occupation:
    Thai Boxer
    Location:
    UK
    Home Page:
    In theory it shouldn't have any impact on your SERPs, however, once upon a time it was a common black hat technique to create cloaked/doorway pages, which meta refreshes and redirects were made use of. To be on the safe side you could disallow spiders crawling your 'offline' pages in robots.txt
     
    • Thanks Thanks x 1
  6. SuperNoobInc

    SuperNoobInc Regular Member

    Joined:
    Dec 28, 2011
    Messages:
    467
    Likes Received:
    32
    Thanks again.
    So whats the difference between meta-refresh and redirecting via .htaccess?
    (I was about to try .htaccess redirect, but I went with on-page redirection instead)

    When it comes to priority, which one does crawlers read first?
     
  7. Abstroose

    Abstroose Elite Member

    Joined:
    Nov 20, 2008
    Messages:
    2,097
    Likes Received:
    3,475
    Occupation:
    Thai Boxer
    Location:
    UK
    Home Page:
    .htaccess will have priority. I'm not sure if a .htaccess redirect will prevent bots from reading the Analytics tracking code, so better to stick with the meta-refresh.
     
    • Thanks Thanks x 1
  8. thejake

    thejake Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 13, 2009
    Messages:
    685
    Likes Received:
    828
    To make sure analytics fires before the redirect occurs it's safest to use a javascript redirect in the body, making sure you're using analytics script in the head, thus:
    Code:
    
    var redirWait = setInterval(function() {
        if (document.readyState === "complete") {
            clearInterval(redirWait);
            window.location.href="http://destination.example.com";
        }
    }, 100);
    
    
     
    • Thanks Thanks x 1