1
votes

I'm using an repackaged version apache which is called IHS (IBM HTTP Server). Basical the same as apache web serve with other features. What I'm trying to accomplish is to apply the rewrite rule to hide the complicated url with query strings with a shorten url.

Originally when I first test this out with 'R' Flag it work fine. It was able to match the pattern and response with the proper long url by redirecdt to the final url.

eg: https://example.com/us/ABC/123 -> https://example.com/webapp/headerText=ABC&categoryId=123

But after I have remote the 'R' flag, my rewrite failed with message of " File does not exist: /opt/IBM/HTTPServer/htdocs/dmcst/webapp". I'm trying to show the shorten url without given user the full url. The /webapp/.. is not an local path but rather it is a some other remote path. Why would this fail for 'rewrite' but not 'redirect'?


RewriteEngine on Alias /wcsstore "/opt/IBM/WebSphere/AppServer/profiles/dmcwcsst/installedApps/WC_dmcwcsst_cell/WC_dmcwcsst.ear/Stores.war" Alias /wcs "/opt/IBM/WebSphere/AppServer/profiles/dmcwcsst/installedApps/WC_dmcwcsst_cell/WC_dmcwcsst.ear/CommerceAccelerator.war" Alias /static "/opt/IBM/content"

RewriteRule ^/us/([a-z].)/([0-9].)/?$ /webapp/wcs/stores/servlet/AcquisitionBrowseView?langId=-1&storeId=10001&catalogId=10051&headerText=$1&categoryId=$2 [NC,R,L]

2

2 Answers

0
votes

From the WebSphere documentation:

http://publib.boulder.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.nd.multiplatform.doc%2Finfo%2Fae%2Fae%2Fujpx_rewrite.html

Rewriting rules define how the proxy server rewrites URLs. Responses that have been redirected by target servers typically return a 302 status code with a location header that defines the URL that the client should be redirected to. Rewriting this URL is necessary if the target server is not aware of the proxy servers. The redirected URL is modified to correctly point clients to the proxy server instead of directly to a target server that may not be visible to clients. Use the following properties to configure the URL rewriting rules for a proxy server

Avoid trouble: The proxy server only supports rewriting redirected responses. Therefore, these the following settings only apply to redirected responses. These settings do not apply to requests because the proxy server does not support URL rewriting for requests.

0
votes

I had the same issue

It looks like WAS plug-in in not friendly with mod_rewrite

So WAS module declaration (LoadModule was_ap22_module ...) was moved to the bottom of httpd.conf

In my case it helped