I am new to using mod rewrite but all my css and images go wrong if im not in the root directory
i have this as my .htaccess file
RewriteEngine On
RewriteBase /test2/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?url=$1 [QSA,NS]
and
this is my link to my css file
<link rel="stylesheet" type="text/css" href="style.css" />
can anyone help?
cheers matt
You should use an absolute path:
<link rel="stylesheet" type="text/css" href="/style.css" />
or
<link rel="stylesheet" type="text/css" href="//mysite.com/style.css" />
otherwise your browser searches for the stylesheet in the same path youre currently visiting. So if you visit /news/article/1 your browser requests /news/article/1/style.css but it obviously cant find it there.