rewrite subdomain to dynamic folder
2 posts
• Page 1 of 1
rewrite subdomain to dynamic folder
Hi,
I want to rewrite mysubdomain and all pages/folders from this subdomain to following way:
* mysub.mydomain.com -> mydomain.com/xrep/mysub/
* mysub.mydomain.com/anyfolders/anypages.html -> mydomain.com/xrep/mysub/anyfolders/anypages.html
I got a rule that doesn't work.
RewriteCond %{HTTP_HOST} !^www.mydomain.com
RewriteCond %{HTTP_HOST} ^([^.]+).mydomain.com
RewriteRule ^$ /xrep/%1 [NC]
It write me : Bad Request - Request Too Long
Can you help?
Thanks in advance.
I want to rewrite mysubdomain and all pages/folders from this subdomain to following way:
* mysub.mydomain.com -> mydomain.com/xrep/mysub/
* mysub.mydomain.com/anyfolders/anypages.html -> mydomain.com/xrep/mysub/anyfolders/anypages.html
I got a rule that doesn't work.
RewriteCond %{HTTP_HOST} !^www.mydomain.com
RewriteCond %{HTTP_HOST} ^([^.]+).mydomain.com
RewriteRule ^$ /xrep/%1 [NC]
It write me : Bad Request - Request Too Long
Can you help?
Thanks in advance.
Re: rewrite subdomain to dynamic folder
Hello.
First of all I need to clarify what you mean by rewrite here. Term "rewrite" may only apply when a request is internally transferred to another page within one web site. According to your specs I suppose request needs to cross web site's boundaries. In this situation we usually talk about redirect or proxy. Or maybe both mysub.mydomain.com and www.mydomain.com bindings are set up to the same IIS web site? Then rewrite may take place as request will stay on one web site.
And what is your requirement about what user should see in address bar when he visits mysub.mydomain.com/anyfolders/anypages.html? Should he see original address or see mydomain.com/xrep/mysub/anyfolders/anypages.html (then it is redirect)?
First of all I need to clarify what you mean by rewrite here. Term "rewrite" may only apply when a request is internally transferred to another page within one web site. According to your specs I suppose request needs to cross web site's boundaries. In this situation we usually talk about redirect or proxy. Or maybe both mysub.mydomain.com and www.mydomain.com bindings are set up to the same IIS web site? Then rewrite may take place as request will stay on one web site.
And what is your requirement about what user should see in address bar when he visits mysub.mydomain.com/anyfolders/anypages.html? Should he see original address or see mydomain.com/xrep/mysub/anyfolders/anypages.html (then it is redirect)?
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 10 guests