网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 服务器与数据库 > 服务器环境搭建
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

服务器环境搭建 Windows,Linux,IIS,Apache等服务器配置、安全维护以及PHP和MYSQL运行环境讨论。

Reply
 
Thread Tools Display Modes
  #1   IP: 117.95.53.152
Old 2009-05-16, 11:31 AM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default 一个空间绑多域名,.htaccess方法

Can I host multiple domains on one account?

Yes, using our Domain Alias service.

A Domain Alias allows additional domain names to all lead to same account. There are several ways you can use this service:


Multiple Domains, One Website

For example, if you are hosting your domain name "original.com" with us and added a Domain Alias for "alias.com", then http://www.original.com and http://www.alias.com would take a visitor to the exact same pages of your original.com website. http://original.com/somefile.html would bring someone to the exact same page as http://alias.com/somefile.html.



Multiple Domains, Multiple Websites

Using this method, you can host an additional website within your account for each Domain Alias you add. This is a custom configuration requiring a couple extra steps.

After adding the Domain Alias in OnSite, then place an .htaccess file in /htdocs/www of the following example format:


Code:
  RewriteEngine On
  RewriteCond %{HTTP_HOST}  alias.com$ [NC]
  RewriteCond %{REQUEST_URI} !^/alias/.*$
  RewriteRule ^(.*)$  /alias/$1
Then, upload your HTML files original.com to /htdocs/www/ and your HTML files for alias.com to /htdocs/www/alias
Reply With Quote
  #2   IP: 117.95.53.152
Old 2009-05-16, 11:31 AM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default

If you want a Domain Alias to redirect and put the correct hostname in
the URL bar of the browser, you can use mod_rewrite. If you are hosting
original.com and have a domain alias of alias.com and you want all
requests for alias.com urls to be redirected back to original.com urls,
then you would put this in an .htaccess file in any directory where you
want this redirection to happen:

Code:
RewriteEngine on
   RewriteCond %{HTTP_HOST} alias.com$   [NC] 
   RewriteRule ^(.*)$  http://www.original.com/$1   [R]
The rule will affect all directories below the one where you put this
.htaccess file. So a request for http://www.alias.com/docs/services.html
will be redirected to http://www.original.com/docs/services.html as
well.
Reply With Quote
  #3   IP: 117.95.53.152
Old 2009-05-16, 11:31 AM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default

If you want a Domain Alias to serve pages only from a certain
subdirectory, you can use this mod_rewrite rule in an .htaccess file in
your /htdocs/www directory of your primary hosting account:

Code:
RewriteEngine on
       RewriteCond %{HTTP_HOST}  alias.com$     [NC]
       RewriteCond %{REQUEST_URI} !^/subdir/.*$ 
       RewriteRule ^(.*)$  http://www.original.com/subdir/$1 [R]
Then when requests for the aliased domain come in, the browser will be
redirected to find files in the subdirectory, while still keeping the
domain name of the domain alias in the browser address bar. Files for
the domain alias in the above example would be served from
/htdocs/www/subdir/
Reply With Quote
  #4   IP: 117.95.53.152
Old 2009-05-16, 11:32 AM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default

If you have a Domain Alias that you'd like to point to a specific
directory of your orginal domain, and you'd like to maintain the domain
name of the Domain Alias in your URL, use the suggested mod_rewrite rule
in the technote posted above (dated 10/07/2002).

Replace line 4 of that rule with the following:

Code:
RewriteRule ^(.*)$  http://www.alias.com/subdir/$1 [R]
Reply With Quote
  #5   IP: 117.95.53.152
Old 2009-05-16, 11:32 AM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default

If abc.com is your original domain and xyz.com is the domain alias, and
you want people going to abc.com to see one site and people going to
xyz.com to see a different site, and you want the hostname to stay as
the user typed it, make a directory called xyz under /htdocs/www and put
the xyz.com website in it. Then use mod_rewrite in an .htaccess file in
/htdocs/www

Code:
RewriteEngine On
  RewriteCond %{HTTP_HOST}  xyz.com$ [NC]
  RewriteCond %{REQUEST_URI} !^/xyz/.*$
  RewriteRule ^(.*)$  /xyz/$1
Now when people go to abc.com they will see the site in /htdocs/www.
When people go to xyz.com, they will be served pages from
/htdocs/www/xyz and the URL in their browser will not change the
hostname or show them the /xyz/.
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

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


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