Htaccess rules to redirect respective HTTP links to HTTP and HTTPS to HTTPS?

If https on RewriteCond %{HTTPS} on RewriteRule ^(.*)$ https://example. Com/$1 R=301,L #else RewriteRule ^(.*)$ example.com/$1 R=301,L.

Unfortunately, that returned a 500 internal server error. Redirection didn't work. – Bad Learner Oct 22 at 15:01 Maybe it's because olddomain.Com and example.

Com are on the same server and also share the same SSL cert? – Bad Learner Oct 22 at 15:06 Sorry. The spaces after the comma shouldn't be there.

Don't know how they got there. I edited the post to correct it. Let me know if it works or not.

– Gerben Oct 22 at 19:37 It's not working completely. http://olddomain.com redirects just fine to http://example.com. But when I go to HTTPS://olddomain.Com, it shows the same URL in the address bar, while showing content from example.

Com (and the content is broken. No styling.) – Bad Learner Oct 23 at 1:18 Have you cleared your browser cache (or use another browser)? Could be some caching issue.

Are there any other rules in the htaccess for oldomain? Is olddomain using the same folder as example. Com?

Can you check the headers sent? – Gerben Oct 23 at 14:14.

Your HTTPS rewritecond is incorrect. Cond is a regex, not an quality test. It should be RewriteCond %{HTTPS}!

^on The %{HTTPS} var will only ever contain on or off. Never =on, so the match fails and triggers the redirect, even if https really is on. Update For an unconditional HTTP->HTTPS redirect you'd need to redirect to an https URL.

Your version just detects if HTTPS is *OFF, then redirects to the same url, causing a loop. What you need is: RewriteCond %{HTTPS}! ^on RewriteRule (.*) https://example.Com/$1 R=301,L.

Marc, that did not work either. Can you edit your answer with the full rule? (Probably I am missing something.) – Bad Learner Oct 9 at 17:27 Okay, maybe I wasn't clear.

I wanted people who came from HTTP://olddomain. Com/1. Html to be redirected to HTTP://newdomain.

Com/1. Html and those who came from HTTPS://olddomain.Com/1. Html to be redirected to HTTPS://newdomain.

Com/1. Html, and so forth. That is, if they came from HTTP connection, they'll be redirected to HTTP new domain.

If they came from HTTPS connection, they'll be redirected to HTTPS new domain. I want htaccess rules for that. Can you help?

– Bad Learner Oct 9 at 20:39.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions