How to Redirect a Parked Domain name to a Specific URL

0
91

Sometimes you need to get a domain for promotion that you are running. Other times, you’ve got a domain and don’t know what to do with it yet. In those cases, you may just want to park the domain and then direct traffic to it to a specific URL that you may own. It’s really easy to do this with some htaccess. Here’s how you do it:

# Redirects
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/promo/ [L,R=302]
</IfModule>

We use 302 to tell the browser that this won’t be permanent. Some day we plan to do something with this domain but we don’t know what yet. Or maybe we just plan on using it for other purposes. Either way, this tell’s Google and the browser to check back because the circumstances may change. If we want to designate this as a permanent redirect, we’d use 301.

The $ after domain.com says that anything after domain.com could be passed as a variable but since we don’t have a trailing $1 in the RewriteRule it’s not being used. We are specifically taking anything at domain.com (or www.domain.com) and sending it directly to www.newdomain.com/promo

We could have done this:

RewriteCond %{HTTP_HOST} ^(www.)?parkeddomain.com$ [NC]
RewriteRule ^(.*)$ http://www.maindomain.com/park/$1 [R=302,L]

Where anything after parkeddomain.com would be attached at the end of www.maindomain.com/park/. For example:

parkkeddomain.com/apples would be redirected to www.maindomain.com/park/apples

See how easy it is? Pretty cool.