Forum Moderators: phranque
I have one site www.widgets.org stored in the directory
/home/encyclo/public_html. In that directory, I'm doing some basic rewriting to make sure a couple of other domain names switch to www.widgets.org. I have a subdomain off the first site, example.widgets.org. It is stored in the directory
/home/encyclo/public_html/example. I've just bought a domain name www.example.com, which now resolves to that subdomain/directory. What I want to do is very simple: any requests for example.widgets.org or example.com should be rewritten to www.example.com. Trouble is, if I place this:
RewriteCond %{HTTP_HOST} ^example\.com [OR]
RewriteCond %{HTTP_HOST} ^example\.widgets\.org
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] in
/home/encyclo/public_html/example, it doesn't work, and if I place it in /home/encyclo/public_html, it redirects to [example.com...] I know, it's Friday night, and it's not safe to be doing rewrites, but has anyone got a clue what I'm doing wrong?
Many thanks for your help.
I think the key is, what do you mean by "which now resolves to that subdomain/directory"? How does it resolve to that subdirectory? You can point the new domain to your server's IP address using the new domain's DNS zone file, but how specifically does it get to its subdomain-subdirectory below document_root?
Look for conflicts there, especially if "there" is a "control panel" of some sort.
Jim
/home/encyclo/public_html/example . There is a bit of cruft in the public_html .htaccess file which I've cleared out, but I think I'm right in thinking that both .htaccess files are going to be parsed by the server when accessing the subdomain/new domain. Thing is, I can't seem to get it to work even if I disable the first .htaccess (unless I'm having caching problems).