is it appropriate to use symbolic links in lieu of domain forwarding?
the situation you are about to read is true. the URLs have been changed to protect the innocent.
let's say I own the following three domains:
www.usa.com
www.wisconsin.com
www.minnesota.com
www.usa.com
is the main site, and people can visit the URL www.usa.com/state/wi
or www.usa.com/state/mn
to view info about their specific state. but users are state jingoists and want to see their own state name in the url.
currently I have domain forwarding with masking setup, but I'm not thrilled with how it works.
so www.usa.com
is the main site, and www.wisconsin.com
forwards to it and masks. the problem is, if you go to www.wisconsin.com
and then start browsing the site, the URL always says www.wisconsin.com
. never a different route, like www.wisconsin.com/state/wi/capital
for example. also the title of the page never changes, and if you hover over links, it shows www.usa.com
. so not ideal.
so the option I am exploring. have all the code on www.usa.com
and then symlink that directory to the www.wisconsin.com
directory. what i'm thinking is this is ideal, as i still only code once (no copy and paste), and the user will see appropriate URL.
third option that came to me as i write this, in cpanel I can change the document root of any addon domain. would pointing these to the same folder be even better?
are there any concerns to consider when using the symlink approach?
tack on question, I'm using Codeigniter, which has you set the base URL in a config file. Are there any security issues to be aware of if I use $_SERVER['SERVER_NAME']
to set this?
apparently no one like this question, so i went ahead and tried option 3. then i use $_SERVER['SERVER_NAME']
to set the base URL in Codeigniter, after checking it against a whitelist. i'd still love to hear if anyone has any comments or concerns on this option (which so far IMHO is far better than domain forwarding).