redirect all requests whilst maintaining security

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 10 May 2012, 07:35

redirect all requests whilst maintaining security

10 May 2012, 07:43

Hi there,

I have a simple problem but I just cannot see a way to do it.

I want all pages to redirect to a new domain whilst keep the SSL (or lack of SSL).
So:

http://olddomain.com/welcome.aspx

becomes:

http://newdomain.com/welcome.aspx

AND:

https://olddomain.com/welcome.aspx

becomes:

https://newdomain.com/welcome.aspx


I currently have:

RewriteCond %{HTTP:Host} (olddomain.com)
RewriteRule (.*) http://newdomain-ascent.com/$1 [R=301,NC,L]

This works but sends all https://olddomain to http://newdomain (drops the https)

Please, if anyone can help me I would very much appreciate it - it's doing my head in!

thanks,

jim

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: redirect all requests whilst maintaining security

10 May 2012, 09:40

Hello,

Please, try using the following 2 rules:

Code: Select all
# FOR https
RewriteCond %{HTTPS} on
RewriteCond %{HTTP:Host} (olddomain\.com)
RewriteRule (.*) https://newdomain-ascent.com/$1 [R=301,NC,L]

#for HTTP
RewriteCond %{HTTPS} !on
RewriteCond %{HTTP:Host} (olddomain\.com)
RewriteRule (.*) http://newdomain-ascent.com/$1 [R=301,NC,L]



Regards
Andrew

User avatar
Posts: 2
Joined: 10 May 2012, 07:35

Re: redirect all requests whilst maintaining security

10 May 2012, 11:06

Hi Andrew,

That worked an absolute treat!

Thanks for your help, it was very much appreciated :-)

m

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 3 guests