View Single Post
  #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