Domain/page redirecting back and forth - best practice?

I think I have this in the right place, so here’s what I’m trying to do, and I’m not sure what the best option is:

I’m finishing up a series of 4 websites: one primary and three secondary, each one on it’s own domain. The company wants all sites to direct to the primary domain site, which will then link back to the others (each site relates to an organization in another state).

For example:

I want to go to www.state1.com and get redirected to www.primarysite.com, then that site will have a link that will go back to www.state1.com/index.php, and from there the site works normally (all links to that site’s main page will reference index.php, not back to the primarysite.com).

I have access to cPanel for each of these domains. I considered making home.php the default page, have that page redirect, then link back to index.php. But I’m hoping for a cleaner way to do it. Anyone have a thought? And did this even make sense?

Whit,

Loopy URLs? If the management that loopy?

Well, it’s not loopy if you’ve described it wrong, i.e., links direct to subdomains could be redirected to the primary/sub and that would actually make sense (although barely).

Okay, specificity, if you please. Yes, I understand the need not to embarass your company so use primary.com and sub1.com, sub2.com, etc. Each sub#.com would have .htaccess files to redirect to the primary/sub# with the {REQUEST_URI} being retained. I’ll help with the mod_rewrite code once the specification is correctly set.

Regards,

DK

Thanks! I’ll see if I can explain it better.

Four domains totally (I haven’t set them up in subdirectories…they’re all on their own hosting accounts):

www.sub1.com
www.sub2.com
www.sub3.com

If a user goes to www.sub1.com, they are redirected to www.primary.com. Now this main website has general company-wide info as well as, on the main page, prominent links that go back to all three of the sub sites. The thinking is that they want users to go to the main site before heading to any of the sub sites (each sub site is location-based — different state for each).

Here’s what I did: I juts put an htaccess file in the root public directory with a DirectoryIndex home.php index.php in it. The home.php file that each of the sub domains have redirects the user to the primary.com website. That website then has links that will go to www.sub1.com/index.php, etc. Since the index.php file doesn’t redirect the user, they can then navigate the website normally, and any internal links back to that site’s home page goes to index.php.

The one advantage to do it the way I did, that I can figure, is that employees or frequent visitors can just bookmark www.sub1.com/index.php (instead of www.sub1.com) and bypass the redirect to the main website. But I don’t know if there’s a big disadvantage to the way I set it up.

If there’s a compelling reason for me to do this another way, I’m all for it. (While I understand why they’re doing it, it seems like more of an annoyance to their users.) Otherwise, any other suggestions would be greatly appreciated.

Thanks DK!

Whit,

Whew! That helped immensely, thanks!

Yes, it makes sense the way that you’ve done it IF each sub# manages their own domain (and you are not responsible for that).

On the other hand, since you’re asking, if you are responsible for every domain (primary and subs), I’d simply combine them into a “standard” cPanel master/addon set of domains (the addon domains also become subdomains). That would:

  • Allow you to manage all websites easier
  • Standardize CSS (page layout - the look and feel of the company across its state entities) by sharing files
    [indent]OMG! I can’t believe the corporate IT would not enforce standardization across all units.[/indent]
  • Standardize payment gateways
  • Standardize e-mail
  • Etc.

You could still utilize your sub# domains in the same manner in which you’re using home.php as the default sub# Home Page with index.php being their “real” Home Page but the standardization (and ease of access to each account) would make the “subdomain” approach of cPanel Addon Domains far simpler. It would also be less costly (a very minor factor) as you wouldn’t need to hold four (or more) accounts. After all, the real cost of multiple domains is in the management which you are providing.

Regards,

DK