Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a main site http://qweop.com, and I would like to add an alias to it called http://qwepo.com.

Now if I use a CNAME (currently this is what I'm using) on qwepo which maps www to qweop.com, then when i go http://qwepo.com I will be shown the content from http://qweop.com

This is fine, however I want the browser address bar to show qweop.com instead of qwepo.com even if the user types visits http://qwepo.com and not http://qweop.com.

Now I've heard of the 301 moved permanently, but it seems like it's a solution for people who have a new url for their website (which is of course not in my case here).

What other choices do we have other than the 301 redirect and CNAME on DNS ?

Basically the end result is that whenever someone types qwepo.com/foobar it will bring them to qweop.com/foobar AND the address bar will show qweop.com/foobar

PS: is domain forwarding the same thing as a 301 redirect? is masking the same thing as a CNAME on DNS ?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Basically the end result is that whenever someone types qwepo.com/foobar it will bring them to qweop.com/foobar AND the address bar will show qweop.com/foobar

301 Permanent Redirect is EXACTLY what you need here.

That's what Wikipedia says about your case: http://en.wikipedia.org/wiki/URL_redirection#Similar_domain_names


If you web server is Apache, then this is the rule that will do such redirect (mod_rewrite is required):

RewriteEngine On

RewriteCond %{HTTP_HOST} =qwepo.com
RewriteRule .* http://qweop.com%{REQUEST_URI} [R=301,L]

If it is IIS 7.x, then use the following rule (using URL Rewrite module):

<system.webServer>
    <rewrite>
        <rules>
            <rule name="Proper Domain Name" stopProcessing="true">
                <match url=".*" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="qwepo.com" />
                </conditions>
                <action type="Redirect" url="http://qweop.com{REQUEST_URI}" redirectType="Permanent" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.