Javascript is client-side. Mod_rewrite is server-side.
Therefore, Javascript will never see the rewritten URL. For your browser, the URL you entered is the final address.
The only real solution is to change your Javascript so that it looks at the URL it received, and not the old version (or perhaps parsed both alternatives, as the old URL will still work, and people may still have the old ones bookmarks).
Another possible solution would be to go to your server code (PHP? Whatever?), Where you can see the rewritten URL and insert some javascript code there that you can parse on the client side. Not a perfect solution. You'd better just go with option 1 and change Javascript to handle the URLs that it will actually receive.
Spudley
source share