Wen
Wen

Reputation: 13

how do I redirect a subdomain to another subdomain where query string must remain intact

I have subdomain http://example.website.com

and I need it to redirect to another subdomain http://othersite.website.com?os_username=admin&os_password=1234

I need the query string (with un and pw) to remain intact upon the site being redirected.

Right now the query string drops off and you're taken to the general login page.

Any ideas on how to do this?

Upvotes: 0

Views: 209

Answers (2)

Dan
Dan

Reputation: 2719

It will be something like this if you are using .htaccess:

RewriteEngine On

# Map http://example.website.com to http://othersite.website.com?os_username=admin&os_password=1234

RewriteRule ^$ http://othersite.website.com?os_username=admin&os_password=1234 [L]

Although I don't think it will work across a different domain I have yet to test it since I am at work. Usually I use it like so:

RewriteEngine On

# Map http://www.website.com to /index
RewriteRule ^$ /index [L]

That will redirect www.website.com to www.website.com/index. I hope that helps.

Upvotes: 0

Wei
Wei

Reputation: 21

Since you're dealing with username and passwords, why not just post the information on the server, set the cookie, then redirect the user after the cookie has been set?

Upvotes: 0

Related Questions