1

i got some problems with the mod_rewrite.

I want to redirect all requests to one page (app.php). It works fine:

<IfModule mod_rewrite.c>

  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond $1!^(app\.php|assets|editor|css|js|scripts|images|img|media|xml|user_guide|robots\.txt|favicon\.ico)
  RewriteRule ^(.*)$ app.php/$1 [L,QSA]

</IfModule>

Okay so when i want to bind an css file, for example:

<link rel="stylesheet" type="text/css" href="../app/templates/style.css">

The chrome browser "firebug" shows me

style.css  /app/templates GET 200 OK

But the css isnt include. I google for hours and didnt find anything. Even on stackoverflow i try'd some solutions. Hope you can help me.

1 Answer 1

1

Problem is coming due to your use of relative URLs for css/js/images.

You have 2 options to fix it:

  1. Just use absolute path in your css, js, images files rather than a relative one. Which means you have to make sure path of these files start either with http:// or a slash /.

  2. You can try adding this in your page's header:

UPDATE:

  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond $1 !^(app\.php|assets|editor|css|js|scripts|templates|images|img|media|xml|user_guide|robots\.txt|favicon\.ico)
  RewriteCond $1 !\.(css|js|jpe?g|gif|png|tiff)$
  RewriteRule ^(.+)$ app.php/$1 [L,QSA]
Sign up to request clarification or add additional context in comments.

6 Comments

Hey. I try the absolute path "localhost/app/templates/style.css" but it still not works. Chrome still says "200 GET OK" I cant try your second solution because there is nothing coming after the ":"
If you enter this css link in browser do you see your css code?
Nope i dont see it. But it is there on this location.
If you don't see anything then of course browser will also not see it.
If you comment out your existing rule does it help?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.