网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > 建站交流
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

建站交流 讨论网站建设的基本方法、技巧、空间问题讨论、域名交流、
资源分享、技术交流,站长们经常进来看看噢!

Reply
 
Thread Tools Display Modes
  #1   IP: 222.184.115.77
Old 2007-08-18, 01:25 AM
smiling smiling is offline
高级会员
 
Join Date: 2006-02-12
Posts: 502
smiling 正向着好的方向发展
Default mapping multiple domains into the filespace of a single domain

There is simply no reason to expose the subdirectories, *and* it makes the URLs ugly, so don't do a redirect. Use an internal rewrite instead. It's very simple code, and nothing to be concerned with SEO-wise.

Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{HTTP_HOST} ^(www\.)?domainA\.com [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteCond $1!^domainA/
RewriteRule (.*) /domainA/$1 [L]
#
RewriteCond %{HTTP_HOST} ^(www\.)?domainB\.com
RewriteCond $1!^domainB/
RewriteRule (.*) /domainB/$1 [L]

Each domain is rewritten to its own subdirectory, unless the request has already been rewritten to the subdirectory (mod_rewrite in .htaccess appears to be recursive, so testing for this case is necessary if the code is in .htaccess, but not if it's in httpd.conf).
Search engines and visitors will be entirely unaware that two sites are hosted under the same account, unless they investigate the domain registrations and DNS records; the rewrite process itself is entirely transparent.

You can move everything, including a robots.txt file for each domain, into its own subdirectory; the only file needed in the home directory is this .htaccess file.

True HTTP/1.0 clients do not provide a host header. For this reason, a default rewrite (to domainA) is provided above. While many clients advertise that they are HTTP/1.0, most have been modified to send the host header, since otherwise they cannot access any sites that are hosted on name-based virtual servers (Name-based servers depend on the HTTP host header to figure out which of the many sites at the same IP address to serve).

Since you've set up the DNS, the only concern is whether your server is set up to accept both domain names and send requests for them to your document root ('home' directory). If that's taken care of, then adding the above rules to your existing .htaccess file should do what you need.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Volume! What to do about domains? sunshine Google Adsense 0 2006-12-11 09:41 AM

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 10:45 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.