0

A business partner asked us to implement a list of 1000+ URL redirects from http://site1.com to https://site2.com. We set up an (old) Apache 2.2 which we cannot upgrade as follows:

<VirtualHost *:80>
  ServerName site1.com
  ServerAlias *.site1.com
  Redirect 301 /url-0001 https://site2.com/...
  Redirect 301 /url-0002 https://site2.com/...
  Redirect 301 /url-0003 https://site2.com/...
  ...
  Redirect 301 /url-1234 https://site2.com/url-...
  RedirectMatch 301 ^(.*)$ https://site2.com/
</VirtualHost>

Problem:

Any redirect after the first 400+ does not work correctly, i.e., instead of the following redirect:

http://site1.com/url-410 --> https://site2.com/foo

we get:

http://site1.com/url-410 --> https://site2.com/url-410

It seems the URI is not being rewritten correctly.

Question: Is there a limit of how many redirect directives one can use in a single vhost or am I missing something obvious here?

0

Root Cause: Redirect #400 looked as follows:

Redirect 301 / https://site2.com/

All URLs after this one got 404.

Solution: After removing this redirect everything worked as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.