Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We are currently moving our site to a CMS, and in the process moving to a different server. There is some code on the older server that we do not want to move to the new server. We want the URLs to be the same, so we have been looking at (and currently using) ProxyPass. The old server actually does this to remap URLs to both public and internal content. The <Proxy> directive on the old server is still commented out and it works fine.

I have tried placing the following in several places, inside a virtual host directive, outside of it, etc. I get no errors starting apache, but it never works.

ProxyRequests On
Order allow,deny
Allow from all
ProxyVia On
ProxyPreserveHost On
ProxyPass /tester/ http://oldserver.companyname.com/app1/
ProxyPassReverse /tester/ http://oldserver.companyname.com/app1/

I have tried several examples, much less permissive than this, much simpler, etc.

Apache seems to ignore the tester, and sends it along to the CMS which then returns a 404. We would like to have tester mask the old URL, which is what we currently do on our other machine.

This particular virtual host does have a few rewrite rules, and I have tried placing these before or afterwards as well. The modules are loaded earlier in the httpd.conf. Currently running apache 2.2.

As of right now - nothing happens. No errors, no logs (that I see), etc. It's like the rules aren't actually there.

One thing I did notice - it works fine in our other virtual host directive. The only difference is the other one is much smaller, and doesn't contain some rewrite rules for Wordpress.

Here is an example of my VirtualHost

<VirtualHost *:80>
    ServerAdmin webmaster@site.com.local
    DocumentRoot /var/www/html/wordpress
    ServerName wptest    
    ServerAlias wptest.site.com.local

    ErrorLog /var/log/httpd/wordpress-error-log
    CustomLog /var/log/httpd/wordpress-access-log common

    ProxyPass /tester http://www.company.com/app1

    RewriteEngine On   

    <IfModule mod_rewrite.c>
      #RewriteBase /wordpress/
      # Switched the logging on 2/15/13 JMD
      RewriteLog "/var/log/httpd/rewrite_log"
      RewriteLogLevel 4

    # From http://stackoverflow.com/questions/13235180/how-to-remove-trailing-slash-for-folder-index-html-when-index-html-is-stri

    # If it's a request to index(.html)
    RewriteCond %{THE_REQUEST} \ /(.+/)?index(\.html)?(\?.*)?\  [NC]
    # Remove it.
    RewriteRule ^(.+/)?index(\.html)?$ /%1 [R=301,L]    

     RewriteCond %{REQUEST_URI} \.html$
     RewriteRule ^(.*)\.html$ $1 [R=301,L]    

      RewriteRule ^/index\.php$ - [L]
      RewriteRule ^/css/(.*) /wp-content/themes/our2012/css/$1 [QSA,L]
      RewriteRule ^/js/(.*) /wp-content/themes/our2012/js/$1 [QSA,L]
      RewriteRule ^/img/(.*) /wp-content/themes/our2012/img/$1 [QSA,L]
      RewriteRule ^/font/(.*) /wp-content/themes/our2012/font/$1 [QSA,L]
      RewriteRule ^/plugins/(.*) /wp-content/plugins/$1 [QSA,L]
      RewriteRule . /index.php [L]    

(crossposted from StackOverflow per request)

share|improve this question
you should add the rest of the apache config since the problem probably come from what's not shown here. –  ETL Feb 26 '13 at 16:55

1 Answer 1

If your CMS is using Mod rewrites in an .htaccess, domain.com/test may be getting handled before the proxypass.

something you may consider is using a rewrite rule with a [p] flag along with your wordpress rewrite rules.

(untested rule quickly thrown together as an example)

RewriteRule /test/$ http://oldserver.example.com/ [P]
ProxyPassReverse /test/ http://oldserver.example.com/


Another link with information about using mod_rewrite to Proxy

share|improve this answer
It is, but in the httpd.conf, no htaccess. How do I get proxy pass to get to it first? its located before it in the httpd.conf –  jmlumpkin Feb 26 '13 at 18:31
Would this mask oldserver behind test? Or does it just redirect them to it? –  jmlumpkin Feb 27 '13 at 12:48
The description of the flag implies it utilizes the mod_proxy module which should be the same as using proxyPass. One thing to note is the mention of a performance hit when using the [p] flag instead of ProxyPass. I've also updated my answer to include a proxypassreverse. –  Nathan Feb 27 '13 at 14:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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