Forum Moderators: phranque
I'm using mod_rewrite to substitute
localhost/index.php?m=static&a=someaction
to
localhost/static/someaction
Whilst my RewriteRules do ok for redirection, they change the ./ path for php, so an image in /sitefolder/images/ gets included as /sitefolder/static/images!
Or, more clearly, when opening
localhost/static/somepage
if the page has a <img src="images/image.jpg" /> it gets replaced as <img src="static/images/image.jpg />.
One workaround was to specify the full file location in a variable and paste it all over the place, but is there a simpler way?
Four solutions (in no particular order) are:
1) Use server-relative links on the pages, e.g. "/images/logo.gif" instead of "../images/logo.gif"
2) Use fully-qualified links on the pages, e.g. "http://example.com/images/logo.gif"
3) Add an exception to the current rule for all relatively-linked 'included' page objects based on URL-path or filetype.
4) Add another rule to 'correct' the incorrectly-rewritten links.
Jim