breaking links when url is not rewriten with "R" switch

Oct 3, 2008 at 7:58 PM
Edited Apr 10, 2009 at 1:29 PM
how do you guys deal with this problem when you can not edit the actual aspx pages?
(our code pages are from a 3rd party and we can't rely on changing their code files as updates will likely break things)

my filter:
ReWriteCond %{SERVER_PORT} ^80$
ReWriteCond %{HTTP_HOST} ^(www\.fcp\.com)(.*)$ [I]
RewriteRule ^/(.*)$1 [I,R]
# actual url:
# friendly url:
#  (with our w/out trailing "/")
ReWriteRule ^(.*)/(img)/(sms)/?$ $1/items.aspx?Code=SMS&key=cat [I,R,U,L]

* note: neither "img" nor "sms" are physical directories on our web server *

with the "R" switch on this rule:  ReWriteRule ^(.*)/(img)/(sms)/?$ $1/items.aspx?Code=SMS&key=cat [I,R,U,L]
redirects properly to
and maintains all css and image associations.

The problem is that the url is actually rewritten in the browser's address bar to ""
That defeats the purpose, as now the url is ugly - and any bookmarking or linking that the visitor does will likely be with the ugly url - not my clean url.

If I remove the "R" switch from the rule ...
ReWriteRule ^(.*)/(img)/(sms)/?$ $1/items.aspx?Code=SMS&key=cat [I,U,L]

the url is not rewritten in the browser's address bar, but links throughout the page change - which breaks css and images (and possibly other hard links).

Oct 4, 2008 at 12:33 AM
see the other thread on the same same topic -
by b01

Oct 6, 2008 at 2:25 PM
Edited Apr 10, 2009 at 1:37 PM
this post:
suggests using HTTP_X_REWRITE_URL but I don't see any examples of that in the readme.

I have tried using (and not using) the R switch.  I have also tried using the "U" switch.

D:\<path>\ASP.NET Template is my root directory. "img" is not an actual directory.

Oct 6, 2008 at 8:48 PM

fcp, I'm not sure what you are asking.

I've read the readme multiple times but do not understand what I need to be doing with the switches to or HTTP_X_REWRITE_URL to use the actual path.

What actual path? And when you say "use the actual path", what do you mean by "use" ?

if you can speak my language , I might be able to help you.

Oct 6, 2008 at 9:00 PM
thanks Cheeso

see this thread instead:

I think I cleared up what I was asking for on that thread enough that you'll be able to understand what I'm asking.

let's give up on this one.
I was able to get most of what I wanted by adding base href in the master page file for our site