Featured post
.htaccess - Apache subdomain and domain redirections -
i have following situation tackle, have domain , subdomain pointing same resource.
www.mydomain.com , sub1.mydomain.com
what i'm trying achieve following:
i subdomain
redirect root sub-folder of system. sub1.mydomain.com --> sub1.mydomain.com/subdomainsrootfolder/sub1/
redirect main domain when uri not below "/subdomainsrootfolder/sub1/" structure requested. i.e. sub1.mydomain.com/subsrootfolder/sub1/() served if sub1.mydomain.com/() requested redirect www.mydomain.com/(*)
thanks lot insights!
ex.
case 1. sub1.domain.com --> sub1.domain.com/subrootfolder/sub1/
case 2. sub1.domain.com/subrootfolder/sub1/* --> is
case 3. sub1.domain.com/anyotherfolder/ --> www.domain.com/anyotherfolder/
case 4. www.domain.com/subrootfolder/sub1/* --> sub1.domain.com/subrootfolder/sub1/*
maybe these examples more explanatory text above... :)
rewritecond %{http_host} www\.mydomain\.com rewriterule ^/subrootfolder/sub1/(.*) sub1.domain.com/subrootfolder/sub1/$1 [redirect,last] rewritecond %{http_host} www\.mydomain\.com rewriterule / - [last] rewriterule ^/$ sub1.mydomain.com/subdomainsrootfolder/sub1/ [redirect,last] rewriterule ^/subdomainsrootfolder/sub1/ - [last] rewriterule ^/(.*) www.mydomain.com/$1 [redirect,last]
- Get link
- X
- Other Apps
Comments
Post a Comment