这是可能的,如果是,那么如何?
当我写anything.abc.com/?p=37
时,必须重定向到abc.com/?p=37
。
我想在wordpress中这样做。
答案 0 :(得分:1)
首先,从.htaccess文件中删除写入权限,因为WordPress因覆盖它们而臭名昭着。在public_html根目录的.htaccess中,添加以下代码行。在此之前,请在设置>>中更改网站网址。常规
# .htaccess main domain to subdirectory redirect
# 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]
您可以在BlueHosts网站上阅读更多信息:https://my.bluehost.com/cgi/help/347
答案 1 :(得分:-1)
在Wordpress设置中>一般设置,只需将站点地址URL更改为您想要的任何内容。