我已要求我的域名托管服务商将网站指向我的public_html文件夹。但现在我被告知,如果我需要这个其他域重定向到我的主域网站上的特定网址,我需要在htaccess文件中执行此操作。目前我已经研究过,这是我的htaccess看起来没有任何运气!htaccess外部域名到新域名
# Switch rewrite engine off in case this was installed under HostPay.
RewriteEngine Off
SetEnv DEFAULT_PHP_VERSION 5
DirectoryIndex index.cgi index.php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteCond %{HTTP_HOST} ^otherdomain.org.uk
RewriteRule ^(.*)$ http://www.primarydomain.org/blog/$1 [R=permanent,L]
上面没有将我的otherdomain.org.uk重定向到我的primarydomain.org/blog上的博客页面。请注意,我的primarydomain.org/blog是一个wordpress网站页面。
你需要在'otherdomain.org.uk'服务器的'DocumentRoot'文件夹重定向规则。 – anubhava 2014-09-19 19:03:01
otherdomain.org.uk指向primarydomain.org的htaccess文件所在的同一个public_html文件夹。目前otherdomain.org.uk重定向到primarydomain.org,但不是primarydomain.org/blog/ – user3214892 2014-09-19 19:11:22
请不要这是一个WordPress的页面,所以URL并不真实反映在文档文件夹 – user3214892 2014-09-19 19:21:58