I have a problem, it’s about my rewrite and relative paths.
In my .htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /school
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?page=$1
Which means that I can type http://www.example.com/school/contact and it will take me to index.php?page=contact.
That all works great! But now if I use:
<link href="css/main.css" rel="stylesheet" type="text/css" />
To access my css, it’s a no go. I can’t add the ../ before it, because it is a template that also is used for home. How should I write this so I can relatively access my css folder (and all other folders) no matter what I’m using as my Rewrites?
If it matters at all, I’m using smarty as my template manager.
The
<base>tag typically works or adding a full path to the file (css/img/js/etc) instead of using a relative path.I found this answer sometime ago and it’s pretty descriptive of what I just mentioned Rewrite css/js paths