Reputation: 2508
i needed my URL
/crescenty/name
to redirect to
/crescenty/profile.php?player=name
I've used this mod_rewrite code
RewriteEngine on
RewriteRule ^([a-z]+)$ /crescenty/$1/ [NC,R]
RewriteRule ^([a-z]+)/$ /crescenty/profile.php?player=$1 [NC,R]
But there is a slight problem, the URL doesn't stay, it kept going back to
/crescenty/profile.php?player=name
I tried using the above mod_rewrite code with flag on the last line as [NC,L], the URL stays the way i want it to which is
/crescenty/name
but the page doesn't show up properly (css doesn't seem to apply)
please help!
Upvotes: 0
Views: 75
Reputation: 4976
That's probably because your links are defined as relative to the current directory.
When you rewrite the URL it has one lower level than the original URL (/crescenty/ vs /crescenty/name/). This means resources will be looked for relative to the second directory level which of course won't work.
Change your resource URLs to use URLs relative to the web root by adding a leading slash to your links.
For example change <img href="images/mying.jpg" /> to <img href="/images/mying.jpg" /> (notice the leading slash).
Upvotes: 1