Forum Moderators: open

Message Too Old, No Replies

How to avoid duplicate a website to different subdomains?

         

weaver

1:38 am on Apr 20, 2003 (gmt 0)

10+ Year Member



I have a large web site and would like to have a subdomain for each state (like AL, AK etc.) displaying a different index page. Then I would like to call any of the other pages on the rest of the web site (in the other main folders on the server) from each of the index files (in the subdomain folders) and having a different logo displayed on the upcoming other pages, representing the state of the current subdomain. Can this be done? I'm not good at Javascript so some code example would be nice.
Any help would be appreciated.

DrDoc

4:29 am on Apr 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you know any server-side scripting languages? This is a job for PHP and mod_rewrite. But, now... how much content is supposed to be different? Just the logo, or a lot more?

weaver

5:10 am on Apr 20, 2003 (gmt 0)

10+ Year Member



DrDoc,
Thanks for your reply. Just the logo (a .gif) would be fine. However, when I browse the pages in the main folders the subdomain should still display as the URL, but maybe not necessary if it's hard to accomplish. I don't know much PHP but have done some work with Perl to find and sort entries from a .csv database. I tried to make a .htaccess file with this content to point to a file in another folder, and I put it in my main www folder, but it didn't work. Is there something wrong with this code?

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} sub2.mydomain.com
RewriteCond %{REQUEST_URI}!folder1/key07.htm
RewriteRule ^(.com)$ folder1/key07.htm$1 [L]

weaver

5:44 am on Apr 20, 2003 (gmt 0)

10+ Year Member



Actually I got redirection to work with this code:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} ^sub2.mydomain.com$
RewriteCond %{REQUEST_URI}!^http://mydomain.com/folder1/index07.htm
RewriteRule (.*)$ [mydomain.com...]

In IE the subdomain still shows up as the URL but in Netscape the real folder shows. Is there any way to work around that? And now if the logo would reflect the subdomain I think that would be all that's needed.

weaver

8:04 pm on Apr 20, 2003 (gmt 0)

10+ Year Member



I think I found an easy solution. I just make a framed page for every subdomain where the files from the main folders open in a frame window, and the custom logo still stays on top and the URL still shows that of the subdomain.