将我的域名重定向到子网址

时间:2018-04-12 05:16:26

标签: wordpress

我有一个GoDaddy的域名,我希望它能自动将流量转发到另一个网址。

例如:

我希望www.mydomain.com自动转发/重定向到www.mydomain.com/gooo

我该如何配置?我尝试了几种不同的方法(转发/重定向等),但还没有成功地设法使其正常工作。

这是文件夹网站的.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9] 
{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9] 
{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule . /index.php [L]
</IfModule>

# 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

1 个答案:

答案 0 :(得分:0)

.htaccess文件中输出此行:

RewriteRule ^www.mydomain.com/ /www.mydomain.com/gooo [L,R=301]