0

When i was trying to rewrite url using .htaccess i got my page css disturbed. i don't know why that happened. Anyone please help..

RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.]+)$ $1.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)$ index.php?$1=$2 [L,QSA]

here is the example Without rewriting url

with rewrite rule

  • Your link is broken, but most likely, you are using a relative path for your CSS style sheet. Use an absolute path. – Pekka Jun 06 '12 at 07:17
  • possible duplicate of [Stylesheet does not load after using RewriteRule and include](http://stackoverflow.com/questions/4596044/stylesheet-does-not-load-after-using-rewriterule-and-include) – Emil Vikström Jun 06 '12 at 07:19

2 Answers2

1

Your CSS source is relative to the current document.

Make sure, its an absolute URL.. since

in case of rewrite, its requesting, field/stylesheets/style.css instead of stylesheets/style.css

your css source should be :

<link href="http://[yoururlhere]/stylesheets/style.css" media="all" rel="stylesheet" type="text/css" />
Ayush Chaudhary
  • 716
  • 1
  • 8
  • 20
0

Your paths are broken. Give the absolute path for the css and put one .htaccess file in css directory with only

RewriteEngine Off

in it

baig772
  • 3,404
  • 11
  • 48
  • 93