国外设计欣赏网站 - DOOOOR.com

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,微信登陆

搜索

[Drupal教程] Drupal 6.X:主域名映射到子目录文件夹的方法 .htaccess (Bluehost)

[复制链接]
发表于 4-13-2012 23:09 | 显示全部楼层 |阅读模式
在bluehost上购买了空间,如何让一个主域名访问子目录呢,最简单方法是用 .htaccess 来进行限制。* O1 r( S/ p0 d( D5 F9 m

5 R3 |/ K' g5 ^8 t4 y* r3 N在bluehost 的/public_html 新建立一个 .htaccess 文件,如果没有这个文件的话。3 T5 ]) U: g/ Q9 e; S/ e5 l* N) J' a6 N

) G! I2 e. _2 q. @' r; k% @+ B6 a  z拷贝下面代码放到 .htaccess 文件里8 M" m7 v, V) \0 a2 r
) _+ _+ A, k" g6 u* h0 G: f) x- D8 V' n
# Bluehost.com
0 I) {% H4 ~! _, g! C! M$ D# .htaccess main domain to subdirectory redirect: X- o) a! A% d
# Copy and paste the following code into the .htaccess file
6 `& N; H+ h! Q9 D- ^, I% G# in the public_html folder of your hosting account
/ c! q& K8 T0 {6 |# }# make the changes to the file according to the instructions.( T3 n7 ?  }4 L4 l' D" _; h: O7 W
# Do not change this line.) J2 \' M/ U" @, ~
RewriteEngine on
; P0 K: T: F0 ^) ]6 U. V% R. c" u# Change yourdomain.com to be your main domain. 添加你的主域名9 L2 J6 h9 J$ o$ x1 Y! o  L- }+ r
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
5 f5 d0 [4 J6 k% j# Change 'subdirectory' to be the directory you will use for your main domain. 需要指定的子目录
( N  J  Y: a: y( E+ s; L1 uRewriteCond %{REQUEST_URI} !^/subdirectory/
! r0 T5 v$ z7 P0 u3 }( q5 r- t# Don't change this line.
1 _& Z+ Q; C/ k9 ?- ARewriteCond %{REQUEST_FILENAME} !-f
0 h( U$ z) c& E- J( ZRewriteCond %{REQUEST_FILENAME} !-d
: R7 ~/ }+ @  C6 {# Change 'subdirectory' to be the directory you will use for your main domain. 需要指定的子目录
8 \8 P- F: K7 v$ v; f& k9 i. ZRewriteRule ^(.*)$ /subdirectory/$1
; D! T% b0 I0 U( f2 s, @# Change yourdomain.com to be your main domain again.
0 K! y) x, s; l# Change 'subdirectory' to be the directory you will use for your main domain- G, B8 c2 v* _4 h' q5 y
# followed by / then the main file for your site, index.php, index.html, etc. 主域名. @  I5 e7 S+ G  x' D1 Z+ A
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$5 P: e9 I5 t5 Y: `- C, b
RewriteRule ^(/)?$ subdirectory/index.php [L]
% B9 C" o. ^: h7 n7 j
6 l8 h3 p4 {) ^* Q* o
4 @- b1 P  i1 {) N. v本文选自:Hello,Drupal,谢谢!
& V" ~1 w5 s" f7 L0 X* a, n6 B1 a5 v" l
) ]6 i9 ?) B1 f& @/ J

|2011-2026-版权声明|平台(网站)公约|DOOOOR 设计网 ( 吉ICP备2022003869号 )

GMT+8, 2-12-2025 18:37 , Processed in 4.649080 second(s), 154 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表