Last active
December 20, 2015 11:53
-
-
Save adhpawal/58d3a1faa132de38bb92 to your computer and use it in GitHub Desktop.
Sometime we need to rewrite the URL to strip the context-root from the URL.This block of code works on the Virtual Host which has proxy connection to Application Server using AJP . We are creating solution for achieving :: example.com/helloworld ==> example.com. Please make sure you have enabled the rewrite engine for Apache.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName example.com | |
ErrorLog ${APACHE_LOG_DIR}/error_ci.log | |
CustomLog ${APACHE_LOG_DIR}/access_ci.log combined | |
ProxyPass / ajp://localhost:8009/context-root/ | |
ProxyPassReverse / ajp://localhost:8009/context-root/ | |
RewriteEngine On | |
RewriteCond %{THE_REQUEST} /context-url/ | |
RewriteRule ^/context-url/(.*)$ /$1 [R] | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment