Hi All,
I’ve created these rewrite rules for the first time in my life :
RewriteEngine on
RewriteRule ^([a-zA-Z_]+)$ index.php?page=$1 [L]
RewriteRule ^([a-zA-Z_]+)/([a-zA-Z_]+)$ index.php?page=$1&group=$2 [L]
the rules are working, the server is configured. BUT now, in the case the resulting url is www.somesite.com/home/artists (which is a result for : www.somesite.com/index.php?page=home&group=artists ) the css stylesheet cannot be loaded because of the path :
<link rel="stylesheet" href="css/blueprint/div_styles.css" type="text/css">
What is the correct procedure in this case??? Do I need to give a complete path for the css file (i.e. http://www.somesite.com/css/blueprint/div_styles.css )?
Do you need something like
RewriteCond %{REQUEST_FILENAME} !-f
This will tell Apache to serve the file if there is one, rather than following through the re-write rules.
rpkamp
January 21, 2011, 3:56pm
3
There are two possible solutions:
Provide an absolute URI for the CSS file, either /css/blueprint/div_styles.css or [noparse]http://www.somesite.com/css/blueprint/div_styles.css[/noparse]
Include <base href=“/” /> in the <head> of your HTML
Pick the one you like best (you don’t have to apply both).
What TimIgoe said may also be a good idea but not necessary in your case since the regular expressions do not look for a dot and will thus not match on actual file names (they might on existing directories though!).
Ah, yes, missed the missing / at the start too