ProxyPass Exclude Directory/Path under Apache

ProxyPass Exclude Directory/Path under Apache

We have worked with ProxyPass in Apache in order to redirect a folder or a path to a different location without actually changing it’s location in the browser (basically proxy location). A good alternative to Redirect.

We use ProxyPass a certain directory or path. In some cases ProxyPass is used to redirect an entire website.

The challenge arrises however, when we have to redirect the entire website with the exception of one directory or path.

ProxyPass Exclude Directory/Path under Apache

Let’s take an example of a website which needs to be redirected to But the directory / path of /login should not be redirected. In simple terms the request for should not be redirected.

So a simple redirection for an entire website using ProxyPass can be done using the following in the Apache configuration.

ProxyPass /

Now in order to exclude/ignore the redirection for /login you simple need to add an entry in the format/syntax


The above line needs to be added before the ProxyPass settings.

So in our example you need to add the configuration

ProxyPass /login !
ProxyPass /

ProxyPass Exclude Directory/Path under Apache


  • asdf

    April 8, 2016 at 10:14 am Reply

    Doesn’t work with directories, only files.

    • Gagan

      April 9, 2016 at 11:19 pm Reply

      It works with directories as well. The placement of the ignore rule is the key. You need to mention the path and files which are to be ignored before the actual ProxyPass happens.

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.