![]() |
|
|||||||
| 建站交流 讨论网站建设的基本方法、技巧、空间问题讨论、域名交流、 资源分享、技术交流,站长们经常进来看看噢! |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
IP: 222.184.115.77
|
|||
|
|||
|
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. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
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 |