简体   繁体   中英

Using subdomain as the main domain /HTACCESS?

I'm making a new site and I want to do this: WHEN you access mysite.com FETCH beta.mysite.com

So, when you go to mysite.com/blog it's actually beta.mysite.com/blog I'm really sorry if this was already asked, but I really need some help. I'm not english so I have no idea how to format this question, otherwise I'd google it. Thanks in advance.

(I need it using Htaccess)

Here is one way to do it:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?mysite.com$
RewriteRule ^(.*)$ http://beta.mysite.com/$1 [L,R=301]

If http://mysite.com or http://www.mysite.com is entered, it will redirect to:

http://beta.mysite.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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