Reputation: 23297
I'm having a problem with the linked files in the page that is affected by the scope of the .htaccess file.
Here's the .htaccess file:
RewriteEngine On
RewriteRule ^tp_update/id/([A-Z0-9]+)/([A-Z]+)/?$ update_taxpayer.php?tp_id=$1&tp_type=$2 [NC,L]
I didn't get any error, and I can access this page:
tp_update/id/1234/ITP
But the problem is that, all the files which are linked to update_taxpayer.php is also being affected. When I view the page source and click the link css file. It says the file isn't found:
<link href="../../css/style.css" rel="stylesheet" type="text/css" media="screen" />
And I get this:
tp_update/css/style.css
Instead of the link which I declared above.
How do I get around with this?Is there a proper way of linking files when mod_rewrite is enabled.
Upvotes: 0
Views: 76
Reputation: 1959
You can either use absolute links as Dragon suggested, or you can use the <base href="absolut_base_url">
What this does is make all your relative calls start begin at the absolute_base_url. So (using your style example) if you just had css/style.css
as the href, the browser will attempt to call
http://yoursite.com/absolute_base_url/css/style.css
instead of
http://yoursite.com/absolute_base_url/tp_update/css/style.css
Upvotes: 1