0

I'm trying to redirect a website to a new domain name. The old website wasn't configured correctly and it has URLS that are BOTH http and https. So, half of the urls are https://example.com and the other half are http://example.com.

I didn't realize that the site had any https urls until I finished writing out all of the 301 redirects.

So, right now I have about 300 lines of Redirect 301 that I wrote like this:

# Redirect the posts
Redirect 301 /2016/5/page1/ https://NewUrl.com/page1/

They work when the url is http, but sometimes the URL that I 301'd is an https. When the url is https, the Redirect 301 does not work.

I am hoping that there is some way to fix this without having to rewrite 300 lines.

I've tried to clarify this, but in case it still isn't clear here is another attempt: OLD website has BOTH http and https URLS. New site has ONLY https. I wrote lots of Redirect 301 commands to send the OLD website to the NEW site WITHOUT realizing the OLD site had BOTH http and https links. How do I make sure the old website's 301 urls direct http AND https urls to my new site that only uses https.

To the user who said this was already asked, the suggested duplicate question had nothing to do with 301'ing both http and https from the former blog. This blog has former urls that are http and https indexed and with backlinks. I need both https and https to be forwarded to the new url which is ONLY using https

brclz
  • 806
  • 9
  • 23
jonbon
  • 1,142
  • 3
  • 12
  • 37
  • Possible duplicate of [Using regular expression in htaccess for 301 redirects](http://stackoverflow.com/questions/16665672/using-regular-expression-in-htaccess-for-301-redirects) – 3ocene Oct 23 '16 at 01:36
  • @3ocene their old site did not have both http and https urls.... – jonbon Oct 23 '16 at 05:03
  • Apologies. I misunderstood. This is likely what you're looking for then http://stackoverflow.com/questions/19372594/preserve-http-https-protocol-in-htaccess-redirects. If that's not it, I will admit defeat. It seems strange that this question wouldn't already be answered though. – 3ocene Oct 23 '16 at 05:40
  • I'm not trying to preserve the old format. I want all of the old urls forwarded to https. The problem is that some of the old urls are http and others are https. – jonbon Oct 23 '16 at 20:31
  • Your question has become very unclear and I was not able to understand what you are asking. Could you try to rephrase it and provide exampleS for it? – brclz Oct 24 '16 at 09:14
  • @brclz I tried to clarify. Please let me know if you understand the question now. – jonbon Oct 24 '16 at 18:08
  • @brclz Do you have any suggestions? Or just wanted to edit the question? – jonbon Oct 26 '16 at 00:48
  • @jonbon: If you write redirects how you did `Redirect 301 /2016/5/page1/ https://NewUrl.com/page1/` it will not matter if the source (first part) is http or https, because it only take cares of the path. Is that the answer to your question? – brclz Oct 26 '16 at 09:06
  • @brclz I only noticed this was a problem when I clicked on some results in Google. There are https pages of the old site indexed in Google, and when you click the link it does not correctly redirect the user. Only the http pages in Google are correctly redirecting the user. – jonbon Oct 26 '16 at 09:08

0 Answers0