Redirect Questions


#1

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.


#2

Create [color=#0000CC]old.mydomain.com[/color] in Panel and put a .htaccess file in it:

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

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#3

[quote]RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mydomain.com
RewriteCond %{HTTP_HOST} ^sub.mydomain.com
RewriteRule .* /directory[/quote]
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 -//-