将停放的域重定向到另一个域子文件夹,显示正确的URL

时间:2011-07-29 12:27:48

标签: .htaccess dns

我有2个域名: - domain1.org - domain2.org

我在http:// domain1 .org / wordpress中安装了wordpress,我需要用户输入http:// domain2 .org

目前我的htaccess是(根据此处提到的其他帖子):

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www.)?domain2\.org$ [NC]
RewriteRule ^(.*)$ http://www.domain1.org/wordpress/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
</IfModule>

这可行,但始终在链接中显示domain1 url:

的http:// 域1 。组织/ WordPress的/类别/家具/

在浏览器栏中我有http://www domain2 .org

htaccess是错的吗?我有一个带有godaddy的domain2,我正在做一个蒙面的前锋。也许我应该停放它?

THK。

1 个答案:

答案 0 :(得分:0)

# BEGIN WordPress
<IfModule mod_rewrite.c>   
# tell mod_rewrite to activate and give base for relative paths

RewriteEngine on

RewriteBase /

RewriteCond %{HTTP_HOST} ^(www.)?PARKED.com$
RewriteCond %{REQUEST_URI} !^/PARKED/ 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /PARKED/$1 

RewriteCond %{HTTP_HOST} ^(www.)?PARKED.com$
RewriteRule ^(/)?$ PARKED/index.php [L]

# for main domain

RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]

</IfModule>

# END WordPress