Redirect Questions

Redirect Questions

Posted by: Vash
Posted on: 2009-01-19 22:49:00

I have some questions involving htaccess and CNAMES.

Is is possible to have a virtual subdomain with Dreamhost through htaccess? I think it is possible but my htaccess code is just wrong.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteCond %{HTTP_HOST} ^sub\.mydomain\.com
RewriteRule .* /directory


Is it possible to create a CNAME for example, old.mydomain.com, that will redirect to www.otherdomain.com. Where the otherdomain.com is not host by Dreamhost? From what I have read this is possible if I add "old" as a CNAME and point it to www.otherdomain.com.


Re: Redirect Questions

Posted by: sXi
Posted on: 2009-01-19 23:01:00

In reply to:

Is it possible to create a CNAME for example, old.mydomain.com, that will redirect to www.otherdomain.com. Where the otherdomain.com is not host by Dreamhost? From what I have read this is possible if I add "old" as a CNAME and point it to www.otherdomain.com.


Create old.mydomain.com in Panel and put a .htaccess file in it:

Redirect 301 / http://www.otherdomain.com




How To Install PHP.INI / ionCube on DreamHost

Re: Redirect Questions

Posted by: Atropos7
Posted on: 2009-01-19 23:41:00

In reply to:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteCond %{HTTP_HOST} ^sub\.mydomain\.com
RewriteRule .* /directory


This won't work with just adding a CNAME. DreamHost uses named-based virtual hosting, and thus the server needs to lookup a virtual host entry based on the Host header. You only get those entries by "Adding a New Domain / Sub-domain" in the DreamHost Web Panel, and it doesn't let you add "ServerAlias" directives to make this work. You can try asking support to add them or wildcard DNS but be prepared to make your case.

cool openvein.org -//-

Tags: cnamerewriteruledreamhosthost wwwhtaccesssubdomain