Reputation: 28513
Still on my first attempts with mod_rewrite
. I'm currently doing this to rewrite URLs:
RewriteRule ^/(.*)/$ /index.html?app=%1 [L]
RewriteCond %{REQUEST_URI} !^/(modules|html/.*)$
RewriteRule ^(.*)/(.*)[.,](html|htm)$ /$2.$3?app=$1 [L]
which rewrites:
www.mysite.com/123/ => www.mysite.com/index.html?app=123
www.mysite.com/123/foo.html => www.mysite.com/foo.html?app=123
www.mysite.com/modules/foo.html => www.mysite.com/modules.foo.html
All works fine.
What I would like to know is whether it is possible to access the rewritten URL (like www.mysite.com/index.html?app=123
) from the client. The browser URL shows the SEO-friendly URL, when "in the background", I'm serving the URL as redirected.
Question:
Is there a way to access this rewritten URL on the client using Javascript/jQuery when it's not accessible through window.location.href
?
Thanks for help!
Upvotes: 1
Views: 147
Reputation: 1567
Simple answer: No
The rewriting is done on the server side and there is no way (out of the box) to get to know the rewritten url on the client. This can be used to hide implementation details. If you need the rewritten url you have to send it yourself to the client.
Upvotes: 1