显示子域的别名作为主域名

时间:2017-12-05 11:12:49

标签: wordpress dns subdomain alias yoast

首先感谢您的光临,因为我不知道这些年来没有Stack Overflow我能做些什么!

这就是事情。我在子域中开发了一个Wordpress网站comeovercome.livewithauthenticity.com

我买了一个域别名来轻松访问网址

comeovercome.com

但是当我使用共享功能时,当我设置Yoast SEO插件时,我无法使用此域名作为主要域名,因此在共享帖子中,人们会自动获取长的真实网址而不是简单的网址之一。

如何将网站保留在此子域中,但始终使用漂亮的URL指向它?

我希望我的问题很明确。提前谢谢!

1 个答案:

答案 0 :(得分:0)

在更改任何内容之前,请备份备份备份 阅读#tag评论,然后根据您的域名进行更改

.htaccess主域到子目录重定向

# Do not change this line. 
RewriteEngine on 
# Change example.com to be your main domain. 
RewriteCond %{HTTP_HOST} ^(www.)?example.com$ 
# Change 'subdirectory' to be the directory you will use for your main domain. 
RewriteCond %{REQUEST_URI} !^/subdirectory/ 
# Don't change the following two lines. 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
# Change 'subdirectory' to be the directory you will use for your main domain. 
RewriteRule ^(.*)$ /subdirectory/$1 
# Change example.com to be your main domain again. 
# Change 'subdirectory' to be the directory you will use for your main domain 
# followed by / then the main file for your site, index.php, index.html, etc. 
RewriteCond %{HTTP_HOST} ^(www.)?example.com$ 
RewriteRule ^(/)?$ subdirectory/index.html [L]

由于

相关问题