0

The old website must operate under www.domain.com / remain live during development.

The old website runs forum software that has urls deeply embedded that make it believe it's www.domain.com - and its config produces links with absolute urls pointing to www.domain.com. We need to run a new server to take over the rest of www.domain.com, and proxy through the old website forum so existing urls are all maintained for SEO and bookmarks.

One small help on the old server the apache directive "ServerAlias old.domain.com" returns the correct page from the forum engine when that domain is used in requests, but with a 302 found header with Location: http:// www.domain.com/forum for each response. (This would be typical of any website with ServerName www.domain.com ServerAlias old.domain.com in apache.)

Mod_rewrite is not the way to go performance wise, as we have 500-1000 users 'live' at a time on the forum, so we're attempting to avoid it.

(This question is different from all other redirect questions found here - no other questions discuss keeping the old server using www.domain.com but not having DNS point at it. This situation requires the old server and forum software keep www.domain.com as its config.)

math
  • 151
  • 3

1 Answers1

0

Spent so much time on this, answering my own question here to allow others to benefit:

The absolute urls on the links are ok - www.domain.com is fine, as that points at the new server which will proxy any request that is to www.domain.com/forum/ of course. So we do not have to worry about rewriting those urls in the header or in the html body. (And we cannot simply expose old.domain.com to search engines or users, as that will affect SEO score and be marked as duplicate content for different urls).

Using:

ProxyPass /forum/ http://old.domain.com/forum/

works well, and we do not even need ProxyPassReverse as the old server isn't returning old.domain.com but www.domain.com to us.

The big issue was the 302 found Location: www.domain.com/forum/ header - if we do not strip that off, the browser will reload that url, hit the proxyPass again, and reload over and over til 'too many redirects'.

To strip that off we use a mod_headers directive for that location only:

<Location "/forum/">
  Header unset location
</Location>

and this must be in the config after the ProxyPass directive. (Despite what the docs say, Header directive will work inside ).

To solve the /forum without trailing slash url, we put this before ProxyPass:

Redirect "/forum" http://www.domain.com/forum/

One issue remains in that some cookies or otherwise are being mangled somehow and login credentials are being ignored/rejected. The forum could be comparing cookie content to connecting IP for eg, but this is more a function of the forum's operation than a problem with this general solution.

math
  • 151
  • 3