redirect subdomain and retain url structure

旧街凉风 提交于 2019-12-04 15:01:42

The alternative approach is by editing your web server configuration.

Apache's rewrite rules can do this. You most likely have a .htaccess file in the root directory of your blog. Append the text below to it. If there is no such file, create one.

RewriteEngine On
RewriteCond %{HTTP_HOST} sub.mysite.com
RewriteRule ^(.*)$ http://mysite.com/sub$1 [R=permanent,L]

Your web server has to be configured to accept this configuration from a .htaccess file. It can also be placed in the configuration directly. The procedure for this differs depending on your web host.

The Wordpress Redirection plugin should be able to do exactly what you need.

If it doesn't, you can also accomplish this using your web server's configuration, but it's more complex to set up. See my second answer on this page.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!