views:

31

answers:

2

i have this rewrite rule for my urls, it deosnt seem to acess the css and images, why? :))

orginal url its working:

http://www.example.co.uk/viewprofile.php?user=muna

rewrited url, this deosnt work:

http://www.example.co.uk/user/muna

htaccess code:

RewriteEngine On
RewriteRule ^user/([^/]*)$ /viewprofile.php?user=$1 [L]

my css files are stored in /css folder and images in the /images folder

A: 

sorry guys, i found the solution, im gonna answer this question just for future reference for other stackoverflowers, basically when you do a rewrite on any url just make sure when your linking to javascripts, css or images the right way for example:

if before you had:

<link rel="stylesheet" type="text/css" href="css/demo.css"></link>

then change to this:

 <link rel="stylesheet" type="text/css" href="/css/demo.css"></link>

quote the extra / before css folder name. thanks hope it helps

getaway
A: 

or you can add some rules, and then you may don't need change the html code.

RewriteRule ^user/css/(.*)$ /css/$1 [L]

icyfeel
but is that going to work, on all urls, remember if people rewrite two urls, if you know what i mean, plus it deosnt work
getaway
`i.e. http://www.example.com/topics/stack`
getaway