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

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,微信登陆

搜索

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

[复制链接]
发表于 4-13-2012 23:09 | 显示全部楼层 |阅读模式
在bluehost上购买了空间,如何让一个主域名访问子目录呢,最简单方法是用 .htaccess 来进行限制。# A5 |9 _: z2 a7 o# T* x% f. l# ^
! l1 v  @. u' e/ E8 f
在bluehost 的/public_html 新建立一个 .htaccess 文件,如果没有这个文件的话。* u) m* H& x8 l, x
- y% {" G; H# `' H7 Y; Q
拷贝下面代码放到 .htaccess 文件里
* E$ i! N+ f8 P( U- O, Z' |5 q) ~/ {# A' a
# Bluehost.com8 E* ~* I  w( y, A3 r( A# {
# .htaccess main domain to subdirectory redirect) S' L* a9 s' ?2 N  N  U! H7 n
# Copy and paste the following code into the .htaccess file
! \8 ?/ V8 E/ ^6 ^0 ^9 R& f: {9 Q5 H# in the public_html folder of your hosting account- `$ n% ]. H4 i! W' Z+ C
# make the changes to the file according to the instructions.
/ z' K* V$ A4 |2 s% m- ]# Do not change this line.* x3 A( y) B( ]1 F- k
RewriteEngine on
$ W2 j) V$ P. Z# Change yourdomain.com to be your main domain. 添加你的主域名
# u2 Z" O  C1 I7 S7 E+ M1 PRewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$7 v8 a. m# r5 g& i4 {5 J1 M$ h  w
# Change 'subdirectory' to be the directory you will use for your main domain. 需要指定的子目录9 C( {& k* G6 j, O5 ]/ r
RewriteCond %{REQUEST_URI} !^/subdirectory/0 Y9 X' t* C$ Y$ h
# Don't change this line.
/ o; x8 @' R. v: U2 D; t, C2 _2 iRewriteCond %{REQUEST_FILENAME} !-f
, N' {. W6 v( Q1 O6 j& X' ]% {  FRewriteCond %{REQUEST_FILENAME} !-d' j3 a4 r3 n: }
# Change 'subdirectory' to be the directory you will use for your main domain. 需要指定的子目录" g7 B* Y2 l* K  Y, T
RewriteRule ^(.*)$ /subdirectory/$19 t& ]! h% f2 |3 h. e' q
# Change yourdomain.com to be your main domain again.4 J! g2 o0 F' F* `% f# M
# Change 'subdirectory' to be the directory you will use for your main domain
0 D) m4 V" a1 K3 A# followed by / then the main file for your site, index.php, index.html, etc. 主域名6 y7 _1 k# j# O$ J/ t& d9 G5 n$ M7 |
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
0 g) s5 x* H. j% `$ ZRewriteRule ^(/)?$ subdirectory/index.php [L]
1 o: Y7 J+ E' B# Q7 J1 D7 d$ D: `9 a& Y. \& H6 `/ I

0 V* I2 y8 }/ Q8 i2 p本文选自:Hello,Drupal,谢谢!
4 V; T5 E: S" G8 t& u
0 S/ |9 L* y3 X- `2 x/ ?
* A* Z% z% O2 H

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

GMT+8, 4-16-2025 21:03 , Processed in 0.563546 second(s), 154 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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