Forum Moderators: phranque
i failed to implement the solution on the old thread, i do hope someone can clarify some issues.
i simply want the ff.
For instance
[subdomain1.example.com...] I want redirected to http://www.example.com
[subdomain1.example.com...] I want redirected to http://www.example.com
[subdomain2.example.com...] I want redirected to http://www.example.com
[allsubdomains.example.com...] I want redirected to http://www.example.com
and i am also using DNSMADEEASY for my dns settings.
thank you in advance.
If so, then the following code will do that.
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule .* http://www.example.com/ [R=301,L]
Jim
thank you the reply.
on this issue:
In this particular case:
> [subdomain1.example.com...] I want redirected to http://www.example.com
do you really want to "lose" the name of the page requested by the client, and just redirect to the index page?
yes, it would be too cumbersome to manually recreate/edit every old page & subdomain.
w regards to this,
Also, you did not specify what you wanted to do if the request was for
http://example.com/ or http://example.com/widgets.html -- i.e no subdomain. The code above will redirect these requests, too.
the request for this http://example.com/ should go to http://www.example.com
i tried the code you gave but the subdomains still doesnt redirect to the domain.com
i should take note that my domain nameserver is using dnsmadeeasy.com nameservers, i usually add a cname to every subdomain i need to add on the dnsmadeeasy control panel to support any subdomain changes on the cpanel.
thank you.
Next, be sure that mod_rewrite is working. You may want to write a simple redirect, such as redirecting a non-existent URL to your home page, to be sure that mod_rewrite is properly configured and functioning.
Dump all the "domain forwarding" and simply define additional A records in DNS for all of your domains, pointing them to the IP address of your server. If a domain is "forwarded" by using a redirect of any kind, then all information about the originally-requested domain will be lost, and mod_rewrite won't have any information to act upon.
Lastly, support for control panels of any kind will be necessarily limted here, because everybody ends up using different combinations of site management software, so the number of people who can answer question about these is going to be limited. Control panels make things 'easy' at the cost of greatly-reduced flexibility, and I won't use them unless absolutely necessary. A bit of server configuration knowledge and a few custom scripts can eliminate the need for them completely.
Jim