How to Redirect an Ad-Tracking Link
 by Kristi Hagen

How to Redirect an Ad-Tracking Link

  • I have a client who wants to track radio ad responses by using an easy-to-remember domain name that redirects to a specific page with a longer URL on their main site. However I'm having trouble getting the 301 redirect to work. My redirect looks like this;

    redirect 301 http://Domain.com/
    http://MainDomain/landing-page/ redirect 301 http://www.Domain.com/
    http://MainDomain/landing-page/

    Fyi, in my .htaccess file, located above the redirect, is the following WordPress entry, which redirects requests into the proper subdirectory where the WordPress site is installed:

    # BEGIN WordPress
    
    RewriteEngine On
    RewriteBase /site/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /site/index.php [L]
    
    # END WordPress
    

    The problem I'm having is that the 301 redirect resolves to the home page of the MainDomain (instead of the landing page), as specified in the DNS entry at the host's control panel. What am I missing?

Answer:

First I want to point out that your redirect statements are incorrectly done.

A) - Each Redirect statement must be on one line only, no carrage returns.
B) - Do not mention the domain name at the first part of the statement. Correct format is as follows

redirect 301 /file/pathonly/html  http://www.domain.com/pathtotargetfile.html

C) In many cases you must generate your redirects before the WordPress statements in your htaccess file. Apache executes these statements in top down order, so we need to do our redirects before WordPress gets ahold of the file requests.

For your specific situation, you may want to use a RewriteRule for this redirect. RewriteRules allow us to do a lot more and apply some logic to how the redirect happens. Here's an example that might work ok for you.

Options +FollowSymLinks
RewriteEngine on
# 301 redirects both www and non-www
RewriteCond %{HTTP_HOST} ^Domain\.com$ [NC]
RewriteRule (.*) http://MainDomain.com/landing-page/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.Domain\.com$ [NC]
RewriteRule (.*) http://MainDomain.com/landing-page/$1 [R=301,L]

# BEGIN WordPress

RewriteEngine On
RewriteBase /site/
RewriteRule ^in...

Already a member? Sign in here

Read the rest of this article,
and get all this for only $1.

  • The Search Engine Strategies Updates for February 2018
  • Ultimate Guide to Avoiding Google Penalties
  • The Complete Site Audit Checklist
  • The Definitive Local Search Audit Checklist
  • 100's of Strategic SEO Articles and Q&As
  • The Professional Engine Master's Chart
  • The Internet Marketing Glossary
  • The Ultimate Directory Submission List
  • The Pro SEO's Local Search Directory List
  • 16 years of SEN Archives
  • PLUS, as a Full SEN Basic Member, you'll be eligible for hundreds of dollars of discounts on SEO courses ranging from beginner to master on a variety of topics including organic search, local search, and social networking.

  • Your $1 Trial is good for 7 days at which time your card will be charged $29/mo unless you cancel before March 3rd, 2018

 This form is encrypted for your security

Related Articles & Guides