0

Hello people,

On my site i am using a .htaccess file with a simple rewrite rule:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^servers/(.*)/ index.php?action=servers&id=$1

Allowing visitors of my site to use www.example.com/servers/1/ - which will grab and display the correct page from www.example.com/index.php?action=servers&id=1

In the index.php file, there are links and stylesheets defined with local paths, for example, <link rel="stylesheet" type="text/css" href="style.css" />

Everything works when people access the index.php directly, however, if they use for example www.example.com/servers/1/, the site will grab the content correctly from index.php (+ variable) but subsequently will fail to load any local paths defined in it. As it now is trying to load the style.css from www.example.com/servers/1/style.css

As it appears now, i am forced to use absolute paths, everywhere. Is there any other solution to this problem?

Cheers,
Mac

*EDIT* Sigh, been searching for hours, but somehow always bump to the conclusion a few minutes after posting a thread somewhere. The solution (for me) was HTML's base tag: http://www.w3schools.com/tags/tag_base.asp

Edited by macdonald12: n/a

2
Contributors
1
Reply
4
Views
7 Years
Discussion Span
Last Post by sourcebits
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.