Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite with two domains + subdomain

         

Coreye

10:43 am on Nov 16, 2007 (gmt 0)

10+ Year Member



Hey guys,

I have the same domain name but one is a .com and one is a .net. The .com one is parked.

I have also have a subdomain that I want to work on both the .com and .net. Is there any way to get this to work;

[subdirectory.sitename.net...] works, but I want [subdirectory.sitename.com...] to work also.

I would want this to work also though; [subdirectory.sitename.net...] works but would need this to work: [subdirectory.sitename.com...]

Here is my current .htaccess;

RewriteRule ^site:(.*)/(.*)/(.*)/(.*)$ site.php?module=$1&page=$2&op=$3&ex=$4 [L]
RewriteRule ^site:(.*)/(.*)/(.*)$ site.php?module=$1&page=$2&op=$3 [L]
RewriteRule ^site:(.*)/(.*)$ site.php?module=$1&page=$2 [L]
RewriteRule ^site:(.*)$ site.php?module=$1 [L]
RewriteRule ^_(.*)/(.*)/(.*)/(.*)$ site.php?module=$1&page=$2&op=$3&ex=$4 [L]
RewriteRule ^_(.*)/(.*)/(.*)$ site.php?module=$1&page=$2&op=$3 [L]
RewriteRule ^_(.*)/(.*)$ site.php?module=$1&page=$2 [L]
RewriteRule ^_(.*)$ site.php?module=$1 [L]

Any suggestions?
Thanks,
Corey

[edited by: jdMorgan at 11:18 pm (utc) on Nov. 16, 2007]
[edit reason] Disabled smilies resulting from code [/edit]

jdMorgan

9:10 pm on Nov 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are many variables here, and you have only mentioned a few. First, "parked" is a non-technical term -- It's a marketing term. So, it is essentially meaningless.

In outline, you must change your DNS zone files so that all domain variants are pointed to your server's IP address. You must then change your server configuration so that all these variants are recognized, and 'pointed' to your 'main' site's hosting space (where your code is located).

Once you've accomplished that, you rules will work for all of your domain names and TLDs. However, at that point, I'd suggest you come back and ask how your rules can be made more efficient -- much more efficient. :)

Jim

[edited by: jdMorgan at 9:10 pm (utc) on Nov. 16, 2007]

Coreye

3:03 am on Nov 17, 2007 (gmt 0)

10+ Year Member


"In outline, you must change your DNS zone files so that all domain variants are pointed to your server's IP address. You must then change your server configuration so that all these variants are recognized, and 'pointed' to your 'main' site's hosting space (where your code is located)."

Doesn't "Parked Domains" on Cpanel already do that?

Coreye

11:25 pm on Nov 19, 2007 (gmt 0)

10+ Year Member



Anybody?

jdMorgan

11:50 pm on Nov 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I stay away from cPanel, because the way it does things often causes problems. It also 'writes' some pretty awful mod_rewrite code (because it is so generalized). As a result, I can't really say what it does on any particular host.

The usual approach, as I recall, is to use the "add-on domain" function, and then try to rewrite all URLs to the files in the add-on subdirectory. While it might be more desirable to rewrite them all back to root, this often doesn't work -- at least according to what I see here.

Jim