Sam Cohen
asked on
Proxy Pass + Mod Rewrite
I am trying to re-write only a particular file type. In this case its .jsp - The problem is that the re-write rules are trying to re-write everything to tomcat. I am using:
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} !^/addurl
RewriteRule /*.jsp ajp://127.0.0.1:8009%{REQU EST_URI} [P]
</IfModule>
This works however for any subdirectory such as the one in the example I have to add a rule otherwise its being sent to tomcat. Is there a better way to do this? The reason I am doing this is because the site is comprised of mixed content including Java (.jsp), PHP, and HTML
Any help would be greatly appreciated as this is a time sensitive issue.
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} !^/addurl
RewriteRule /*.jsp ajp://127.0.0.1:8009%{REQU
</IfModule>
This works however for any subdirectory such as the one in the example I have to add a rule otherwise its being sent to tomcat. Is there a better way to do this? The reason I am doing this is because the site is comprised of mixed content including Java (.jsp), PHP, and HTML
Any help would be greatly appreciated as this is a time sensitive issue.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> HTTP Status 404 - /addurl/index.jsp
> type Status report
> message /addurl/index.jsp
That reads like a typical message from tomcat, not apache http server, which means that the request is being proxied but something went wrong at tomcat's side.
> type Status report
> message /addurl/index.jsp
That reads like a typical message from tomcat, not apache http server, which means that the request is being proxied but something went wrong at tomcat's side.
ASKER
In that particular path /addurl there is no JSP, its only php in that particular folder. Thats the problem I am trying to find a way to fix. The root directory is similar to this:
domain.com/ contains java, html and php
domain.com/path/ contains php
domain.com/path2/ contains php and or html
When using the mod rewrite rule that I included in my original post it proxies only *.jsp in the root directory, but tries to proxy any sub directories also which do not contain java.
domain.com/ contains java, html and php
domain.com/path/ contains php
domain.com/path2/ contains php and or html
When using the mod rewrite rule that I included in my original post it proxies only *.jsp in the root directory, but tries to proxy any sub directories also which do not contain java.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome! Combine the rewrite rules and changing the Directory index shes working like a charm!
I had:
DirectoryIndex index.jsp index.php index.htm index.html
which I changed to:
DirectoryIndex index.php index.htm index.html index.jsp
restarted apache(doing this from vhost config, not .htaccess) and she came right up! Thanks!
I had:
DirectoryIndex index.jsp index.php index.htm index.html
which I changed to:
DirectoryIndex index.php index.htm index.html index.jsp
restarted apache(doing this from vhost config, not .htaccess) and she came right up! Thanks!
ASKER
Awesome this helped alot! thanks!
ASKER
HTTP Status 404 - /addurl/index.jsp
type Status report
message /addurl/index.jsp
Also with that said I tried your rules without having "index.jsp" as a directory index type, and without that domain.com/path/ does work, however the index page is .jsp so therefore that no longer works.