Why don't my CSS/images work with absolute paths after rewriting urls?

Discussion in 'Apache' started by AntelopeSalad, Jul 19, 2010.

  1. #1
    I was under the impression if you used absolute paths then they would work regardless of where they were located.

    Here's my .htaccess file: (Apache 2.2.x)

    
    RewriteEngine On
    
    # Force leading www.
    RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/dev/$1 [R=301,L]
    
    # SEO friendly URLs.
    RewriteRule ^(.*)/(.*)/(.*)$ index.php?p=$1&e=$2&k=$3 [L]
    RewriteRule ^(.*)$ index.php?p=$1 [QSA,L]
    
    Code (markup):
    I'm working in the /dev/ folder which is why I have that in the "www" rewrite rule.

    So the problem now is everything works except it's not loading the CSS file or images. I can only assume apache is doing some rewrite to the CSS file but I'm not sure how to fix this correctly.

    It would be crazy if I had to write a specific "skip this file" rule for every css/image/js/etc. file. Also not sure how to modify my rewrite rule to only rewrite index.php (I thought it was doing this already but apparently not?).

    All of my links are absolute.
    http://www.mysite.com/dev/css/base.css
    etc.
     
    AntelopeSalad, Jul 19, 2010 IP