Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

CSS not loading with htaccess rewrite rule

9:56 am on Dec 23, 2011 (gmt 0)

New User

5+ Year Member

joined:Feb 28, 2009
posts: 24
votes: 0

Hai all,

Im using the rewriterule in htaccess for seo friendly url

the url re-writing is working and page is getting displayed..but problem is its not loading the css and images...

Options +FollowSymLinks
RewriteEngine On

RewriteBase /final/

RewriteRule ^books/(.*)/product-([0-9]+)\.html$ productpage.php?name=$1&&productid=$2

Can you please check out what am missing in above code

Awaiting for your replys
10:22 am on Dec 23, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
votes: 347

:: peering into crystal ball ::

You have used relative links for your CSS and images. The rewrite means that these extra files are not where the browser thinks they are.

Solution: Use site-absolute links (the kind with a leading / slash) in all files that are to be rewritten.

g1 will be along presently to say: use site-absolute links all the time, everywhere

Oh, and do something about that (.*) in the middle of the pattern. It's slowing down your server. You probably mean \w+ or [^/]+.