Jump to content

ShortURL's !/cs/


mobik

Recommended Posts

Hi,

 

I would like to rewrite any URL requests not containing /cs/Satellite? to contain this text

 

ie.

 

http://localhost/shorturl -to- http://localhost/cs/Satellite?shorturl

 

My thinking lead me to believe that a simple rule like below would do this:

 

RewriteEngine on

RewriteLog "C:\Temp\rewite.log"

 

RewriteRule !(^cs/Satellite?*)$ cs/Satellite?$1 [L]

 

I appear to be way off though, can anybody help please?

 

Link to comment
Share on other sites

RewriteCond %{REQUEST_URI} ^/cs/Satellite\?*

RewriteRule (.*) /cs/Satellite?$1

 

Should work.

 

 

 

By the way, it's usually a good idea to have the / on the second part of the rewrite rule.  Sometimes Apache does weird things when the / isn't included.

Link to comment
Share on other sites

Hi Corbin,

 

thanks for the reply.

 

I have tried the following rule:

 

RewriteCond %{REQUEST_URI} !^/cs/Satellite\?*

RewriteRule (.*) /cs/Satellite?$1

 

The only change being the NOT on the Condition which is allowing requests with cs/Satellite to work normally which they didn't originally.  Request without cs/Satellite are not appearing to be rewritten though resulting in a 404 error.  I didn't point out that /cs/ is a Tomcat servlet which is being called through proxypass.  This has made me rewrite the rule to include [P] at the end.  I'm now receiving this error

 

Proxy Error

The proxy server received an invalid response from an upstream server.

The proxy server could not handle the request GET /cs/Satellite.

 

Reason: Error reading from remote server

 

Access.log is showing

 

127.0.0.1 - - [11/Feb/2009:14:31:26 +0000] "GET /cs/Satellite?/cs/Satellite HTTP/1.1" 502 403

 

So I think close but no cigar.  I am going to try some variations on the Rule but would welcome any more help with this voodoo please.

 

Thanks

 

Mobik

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.