Forum Moderators: phranque
I have the following link in my sidebar
RewriteRule category/bike_computers/$ /cgi-bin/commerce.cgi?search=action&category=0002&keywords=all&template=style/i/Storebuilder_Type1.html
It works great when in the home directory.
[mydomain.com...]
But when I go to the above URL the link in the sidebar becomes
[mydomain.com...]
and continues to duplicate the /category/ each time the sidebar link is clicked on.
I'm missing something in my rewrite rule.
Please help.
Mod_rewrite does not affect what is displayed in the 'page' that the browser displays, and it does not even affect the browser address bar when doing internal rewrites like yours (as opposed to external redirects).
Mod-Rewrite takes action after a request is received by your server, but before any content-handlers (or scripts) are invoked; It is a 'front-end' process in the UR:-to-filename translation phase, and not a 'content output filter' of any kind.
So the question is, how are the links in your 'sidebar' created?
Jim
I was using ../category/bike_computers/ as the start of the link. Once I put the full domain name first like
[mydomain.com...] all is well.
Thanks for the quick response.
John
/category/bike_computers/
Since that relative URL starts with slash, it is taken to be relative to the domain, not relative to the the current page. To clarify things, bear in mind that it is the client (browser or robot) that resolves relative URLs. This often helps to make sense of some of the curious things you can run into when rewriting URLs.
Jim