简体   繁体   English

在Wordpress Multisite上将非www子文件夹域重定向到www

[英]Redirecting non-www subfolder domain to www on wordpress multisite

I currently have a multisite built in wordpress. 我目前有一个内置于wordpress的多站点。 The domain is set up to be: 域设置为:

http://www.domain.com

The microsites are set up and built out as: 微型站点的设置和扩展为:

http://www.domain.com/location-name 

My issues are with the non-www domains. 我的问题与非www域有关。 If you go to 如果你去

http://domain.com/location-name/ or http://domain.com/location-name/about 

it redirects to http://www.domain.com 它将重定向到http://www.domain.com

I need it to redirect to http://www.domain.com/location-name/ or http://www.domain.com/location-name/about 我需要它重定向到http://www.domain.com/location-name/http://www.domain.com/location-name/about

You can use this to force www using your .htaccess file: 您可以使用.htaccess文件来强制www

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Make sure you clear your cache before testing this. 在测试之前,请确保清除缓存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM