| Author |
|
tehMoo Newbie

Joined: 03 March 2011
Online Status: Offline Posts: 8
|
| Posted: 03 March 2011 at 4:41am | IP Logged
|
|
|
Hi,
I've looked around the forum but I can't see an exact solution to this problem... and I'm not
good with regular expressions either
Problem:
1 old domain must transfer to 1 new domain, and I need rules to cover non-www version of the
old domain to go to the www version of the new domain, and I have to ensure that no one lands
on the old domain with or without www on SSL.
Expected Results (in simple terms):
1) http://olddomain.com -> http://www.newdomain.com
2) http://www.olddomain.com -> http://www.newdomain.com
3) https://olddomain.com -> https://www.newdomain.com
4) https://www.olddomain.com -> https://www.newdomain.com
Thanks in Advance!
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 03 March 2011 at 5:07am | IP Logged
|
|
|
Ok, here's the config for you:
RewriteCond %HTTPS (on)?
RewriteCond Host: (?:www\.)?olddomain\.com
RewriteRule (.*) http(?1s)\://www.newdomain.com$2 [I,RP]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
tehMoo Newbie

Joined: 03 March 2011
Online Status: Offline Posts: 8
|
| Posted: 03 March 2011 at 5:33am | IP Logged
|
|
|
Hi Anton,
Many thank you for the quick response, unfortunately the rules don't work on the site. :(
Originally I had this simple version:
RewriteCond Host: olddomain\.com
RewriteRule (.*) http\://www.newdomain.com$1 [I,RP]
And the redirect worked, though it didn't handle all the issues I had with www and SSL.
So I replaced it with what you suggested, here are the results when I click my links to test it:
1) http://oldsite.com/ - no redirection happens
2) http://www.oldsite.com/ - no redirection happens
3) https://oldsite.com/ - gives an error about the SSL belonging to newdomain, no redirection happens
4) https://www.oldsite.com/ - gives an error about the SSL belonging to newdomain, no redirection happens
There's no entries in the httpd.parse.errors either.
Any ideas?
|
| Back to Top |
|
| |
tehMoo Newbie

Joined: 03 March 2011
Online Status: Offline Posts: 8
|
| Posted: 04 March 2011 at 3:18am | IP Logged
|
|
|
Bump :( any ideas guys please?
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 04 March 2011 at 3:32am | IP Logged
|
|
|
Let's try to fix it this way:
RewriteCond %HTTPS .*on.*
RewriteCond Host: (?:www\.)?olddomain\.com
RewriteRule (.*) https\://www.newdomain.com$1 [I,RP]
RewriteCond Host: (?:www\.)?olddomain\.com
RewriteRule (.*) http\://www.newdomain.com$1 [I,RP]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
tehMoo Newbie

Joined: 03 March 2011
Online Status: Offline Posts: 8
|
| Posted: 04 March 2011 at 4:46am | IP Logged
|
|
|
Thanks again Anton, I've tried that new rule and it still didn't work :(
I have other rules running in the same file, so I'm sure that rewrite is working:
RewriteRule /myfolder/test\.([0-9]+)\.([0-9]+)\.html /myfolder/default.asp?a=$1&b=$2
I've since talked with my server admin, and he tells me that hsphere is running on the server too and I did see a post on the hsphere filter
effecting rewrite back in 2006: http://www.helicontech.com/forum/4325-HTTP_to_HTTPS_redirect_problem.html
Have you come across a solution to this in the mean time?
Thanks
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 04 March 2011 at 5:29am | IP Logged
|
|
|
You see, we haven't had anyone ask about that since than.
And as we had nothing to fix, I have no idea if this other company tried to do smth.
Maybe you should ask your admin to check your https rule with and without hsphere to figure out if it affects the operation.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
tehMoo Newbie

Joined: 03 March 2011
Online Status: Offline Posts: 8
|
| Posted: 04 March 2011 at 6:11am | IP Logged
|
|
|
Will do - thanks again :)
We are going to try removing the hsphere dll to see what
happens, we have another server without it, and rewriting
works perfectly on it. Seems that hsphere dll is some sort
of .htaccess file.
If this works, Ill post back here to let you know, in case
someone else is effected by this in the future.
|
| Back to Top |
|
| |
tehMoo Newbie

Joined: 03 March 2011
Online Status: Offline Posts: 8
|
| Posted: 07 March 2011 at 4:58am | IP Logged
|
|
|
Hi Anton,
We removed the hsphere DLL and restarted IIS and as a
result, this rule below (combined from the ones you gave
me) now works for www and non-www when I comment out the
HTTPS part:
RewriteCond %HTTPS .*on.*
RewriteCond Host: (?:www\.)?olddomain\.com
RewriteRule (.*) http\://www.newdomain.com$2 [I,RP]
Any ideas on the HTTPS? When I leave that part in, the
rules stop working. Is there another way of doing the
https or have you any idea why it isnt working please?
Thanks in advance
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 09 March 2011 at 5:12am | IP Logged
|
|
|
Can you access the newdomain via https directly?
Does it work when you request https://www.newdomain.com?
__________________ Regards,
Anton
|
| Back to Top |
|
| |
tehMoo Newbie

Joined: 03 March 2011
Online Status: Offline Posts: 8
|
| Posted: 16 March 2011 at 5:44am | IP Logged
|
|
|
Hi Anton
Sorry for the delay getting back to you.
Yes, the https is working correctly if we put in the
newdomain.com address, but no redirection is happening from
the old address. :(
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 16 March 2011 at 8:51am | IP Logged
|
|
|
Could we arrange an online meeting or get a remote access, so we could see it in reality?
This would help us resolve the problem faster.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
tehMoo Newbie

Joined: 03 March 2011
Online Status: Offline Posts: 8
|
| Posted: 16 March 2011 at 10:13am | IP Logged
|
|
|
Thanks Anton, sounds like it might be a good plan, let me
talk with our server admin and client and Ill get back to
you.
Cheers
|
| Back to Top |
|
| |