views:

51

answers:

2

Hello, I'm trying to accomplish this:

http://subdomain.server.com/ should redirect to https://secure.server.com/login?subdomain, but http://subdomain.server.com/any-other-page should pass through as-is.

Can I accomplish this in the .htaccess file?

A: 
RedirectMatch ^/?$ https://secure.server.com/login?subdomain
Maurice Perry
A: 

Try this rule:

RewriteCond %{HTTP_HOST} !=secure
RewriteCond %{HTTP_HOST} ^([^/.]+)\.example\.com$
RewriteRule ^$ https://secure.example.com/login?%1
Gumbo