sean14592 Posted February 7, 2013 Share Posted February 7, 2013 Hey, I'm new to using mod_rewrite, I have two url's I currently want to make more SEO friendly: 1) http://domain.com/dir/index.php?p=list&d=all 2) http://domain.com/dir/index.php?p=list&d=cat&c=2 I want these to turn into: 1) http://domain.com/list/all/ 2) http://domain.com/list/cat/2/ Currently my .htaccess looks like this: Options +FollowSymLinks RewriteEngine on RewriteRule (.*)/(.*)/(.*)/ index.php?p=$1&d=$2&c=$3 [L] RewriteRule (.*)/(.*)/ index.php?p=$1&d=$2 [L] Now the rewrite itself works, however all my images and css have disappeared? I'd appreciate it if anyone could help? Kind Regards, Sean Quote Link to comment Share on other sites More sharing options...
requinix Posted February 7, 2013 Share Posted February 7, 2013 Your srcs and hrefs are relative, looking like <img src="folder/image.jpg" /> The browser will calculate the absolute path according to the current directory. After your rewriting of the first page it's "/list/all" so the browser will look for "/list/all/folder/image.jpg". Use a leading slash to make them absolute paths. That way the current directory won't matter. <img src="/folder/image.jpg" /> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.