Apache’s mod_proxy module allows you to forward requests to another server using the ProxyPass and ProxyPassReverse directives. However, in some cases, you may want to exclude certain URLs from being proxied. In this tutorial, I will show you how to exclude an URL from ProxyPass in Apache.

The first step is to identify the URL that you want to exclude from being proxied. For this tutorial, let’s assume that we want to exclude the URL “/static” from being proxied.

Exclude URL in Apache ProxyPass

Apache proxy sends the requests to backend listeners. In some cases, you may need to execute URLs to be proxied. For example. you have some static content that is stored under the “/var/www/html/static”. The application serves the static content, which URLs begin with “/static”. You wanted to service all the URLs that begin with “/static” should be directly served from the directory without proxying them.

You can do this by adding the following configuration before the main ProxyPass settings.

ProxyPass /static !

Alias “https://tecadmin.net/static” “https://tecadmin.net/var/www/html/static”

The ! symbols tell apache, not to proxy requests that are beginning with the “/static” sub url. The Alias map URLs to the “/var/www/html/static” directory.

Make sure that the above configuration is added before the ProxyPass configuration. A sample virtual host looks like the below:

<VirtualHost *:80>

    ServerName example.com

    ProxyPass /static !

    Alias “https://tecadmin.net/static” “https://tecadmin.net/var/www/html/static”

    <Directory “https://tecadmin.net/var/www/html”>

        Require all granted


    ProxyPreserveHost On

    ProxyPass /

    ProxyPassReverse /


Make the required changes in Apache virtual host configuration and restart the Apache service. To test the configuration, access the URL that you excluded from the proxy, in this case, it would be “/static”. If the configuration is correct, you should see the content of your website, instead of being proxied to the backend server.


In conclusion, the mod_proxy Apache module also provides an option to execute the URLs to be proxied. That can be helpful for serving static content directly from the web server instead of proxying them to the backend server. In this tutorial, we have provided you the instructions with an example, to exclude the URLs from ProxyPass in the Apache web server. Remember to test your configuration after making any changes to ensure it is working as expected.