How to redirect a page from domain to subdomain?

wheatgrass

Verified User
Joined
Mar 31, 2006
Messages
16
I had created a subdomain under my domain account in DA. I had moved page.htm from domain to subdomain. How do I configure httpd such that domain.com/page.htm will redirect to subdomain.domain.com/page.htm? I tried the following but it resulted in endless loops and error:

Redirect 301 /page.htm http://subdomain.domain.com/page.htm
 
Has anyone tried the permanent redirect?

The problem of course is that /page.htm refers to both the real /page.htm and the one in the one in subdomain/page.htm, as from the subdomain the root html directory is subdomain/ .

Jeff
 
I just came across (in another thread) some code that will probably work.

Create a page.htm in the public_html directory.

This should be the only content:
Code:
<meta http-equiv=refresh content="0; url=subdomain.domain.com/page.htm">

Jeff
 
Thank you, jlasman, for the explanation and the workaround. But is there a neater solution? Otherwise, I will end up with many such pages as I've moved a number of them.
 
I think I may have found the cause of the problem with regards to the redirect statement in my httpd.conf. I'm using the Custom HTTPD Configurations panel to set the redirection. It seems like any statement that I enter for a domain (virtual host) will apply to all its subdomains (virtual hosts).

How do I specify in the Custom HTTPD Configurations panel such that a redirect statement applies only to the main domain (virtual host), while anoter redirect statement applies only to a subdomain (virtual host)?
 
If you look at your custom httpd configuration you'll see that you don't get much of a choice of where it puts what you type.

I don't have my Apache for Dummies book handy, so you're on your own.

:(

Jeff
 
Other than using htaccess or httpd, what about mod_rewrite etc.? I really need to redirect pages in main domain to same-name files in subdomain. Anyone can help me out here? Thank you in advance.
 
Back
Top