Forum Moderators: phranque
I looked around for several hours and did not see anything that I thought would work. So if anyone can help me it sure would be appreciated.
The script
RewriteEngine On
RewriteRule .* [newdomain.com...] [R=301,L]
seems to work well on all subdirectories and subfiles but it does not redirect the subdomains and their files as well. Is there a script that will take care of all subdirectories and subdomains?
Thanks so much. Any help I get would be deeply appreciated. Have a great day!
Scott
There is the danger that the old pages will now be seen as doorway pages for the new site, so I don't recommend this. There are two safer/better approaches:
These are safer because they eliminate or reduce the number of 'doorway pages' and because they give a better user-experience.
Your rewrite code, as posted, should redirect all requests to the new site. However, in order for it to work, it will have to be in the path from the server root to any subdirectories or subdomains you wish to redirect. So, the problem you're having is probalby that the code is not being executed for subdomain requests. You'll need to investigate how your subdomains are implemented on your server. In other words, for a subdomain request URL, where are the files located in your account's file space? -- How are these URLs 'mapped' into your server's filesystem.. Where are they? You can start with your DNS 'A' records, and trace forward from there.
You may have to put a copy of the code in each subdomain's 'root' folder in order for it to work.
Jim
Hi Jim,
Thanks for taking the time to read and reply. I appreciate it!
One of the domains in particular that I am referring to - gave out free subdomains. There are over 9,900 subdomains that I am aware of. And a lot of these subdomains have subpages in them - they are baby web sites. I bought the domain as is and it was transferred to me as a domain only. Recreating and then redirecting each subdomain's root folder individually would take a tremendous amount of work.
I know there is traffic here but I am not utilizing it. That is why I wanted to redirect all traffic (subdomains included) to a centralized location. That centralized location could be the index page of the web site I am writing about or a different web sites' home page. I don't really care. However, in the future if something like this comes up again it would be nice to know how to do either.
I am not keen on using the 404 or 410 pages as a way of utilizing the traffic as I think not many people will click again.
I was thinking that if I used the 301 permanent redirect then maybe I might not be penalized as having doorway pages. If I do get penalized, then so be it. That is the chance I am willing to take.
So, if you know how to redirect all traffic including subdomains to a centralized location via a 301 redirect - that sure would be nice to know.
Thanks again Jim.
Peace,
Scott