wordpress - Redirect 2nd level subfolders to subdomains -


we have wordpress multisite subdirectory system this:

www.domain.com/demo/john/ www.domain.com/demo/james/ www.domain.com/demo/jane/ etc... 

each of names actual sub site , has own sub pages. have 120+ of such subsites, can guess there lot of pages/url's.

we changing subdomain multisite system, , have create redirections old url's new ones (because system linked many other places).

question:

can have single redirect block in htaccess handle redirections of them?

example of need:

www.domain.com/demo/john/            ->  www.john.domain.com www.domain.com/demo/john/about/      ->  www.john.domain.com/about/ www.domain.com/demo/donald/          ->  www.donald.domain.com www.domain.com/demo/donald/contact/  ->  www.donald.domain.com/contact/ 

this works me, more tests:

rewriteengine on rewritecond %{http_host} ^(www\.)?domain\.com$ rewriterule ^demo/([^/]+)/(.*)$ http://$1.domain.com/$2 [l,qsa,r=301] 

if sees problem in code let me know.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -