0

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

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

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

comeovercome.com

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

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

我希望我的问题很清楚。提前致谢!

4

1 回答 1

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]

谢谢

于 2017-12-07T03:58:31.753 回答