0

I am running into an unusual problem. I have a series of sites that art pointing to my hosted site, for example purposes:

http://sub.mydomain.com/help/

All these other sites use this .htaccess file

Options +FollowSymLinks -Indexes
RewriteEngine on

RewriteRule ^(.*)$ http://sub.mydomain.com/$1 [P,E=Proxy-Host:sub.mydomain.com]

It is working great for the most part. Let's call one of these other domains "sub.otherdomain.com".

If I go to http://sub.otherdomain.com/help/ it works fine.

If I go to http://sub.otherdomain.com/help it is getting redirected to http://sub.mydomain.com/help/

The reason is because mod_dir is redirecting the / to the main domain.

I want it to redirect the / to the proxied domain.

Any ideas?

Charles
  • 50,943
  • 13
  • 104
  • 142
Kerry Jones
  • 21,806
  • 12
  • 62
  • 89
  • You could try `DirectorySlash Off` in your `sub.otherdomain.com` config. – Jon Lin Jul 03 '12 at 21:53
  • Doesn't work - the htaccess on sub.mydomain.com (standard wordpress) is the one that is causing the issue. If you put `DirectorySlash Off` there it simply doesn't work. – Kerry Jones Jul 04 '12 at 00:25

1 Answers1

1

You'll need to set ProxyPassReverse. This can't be done in htaccess. You need to add this in the <VirtualHost> section.

Gerben
  • 16,747
  • 6
  • 37
  • 56
  • VirtualHost of what? httpd.conf? Can you give me an example of what that would look like? – Kerry Jones Jul 04 '12 at 21:09
  • 1
    I meant inside httpd.conf, but it's probably wise to put in into the virtual host that defines otherdomain. Mine is located in `/etc/apache2/site-enabled/`. – Gerben Jul 05 '12 at 16:26