[.htaccess] ReWrite pages, but keep images, css, js, etc [.htaccess]

Joined
Jun 17, 2008
Messages
560
Reaction score
39
Hi There.

I got my .htaccess to redirect like this:
http://mysite.com/collectibles.php
to:
http://mysite.com/credits/collectibles
That works, with this code:

Code:
RewriteEngine On
RewriteRule ^credits/collectibles/ collectibles.php

But, the images and other things that are in this page, like css' and js' etc, etc, think they are in that directory.

For example:

i want image123.png to display on collectibles.php, which is in a folder called images in the root directory, but, i have rewritten it to
http://mysite.com/credits/collectibles

So it thinks that image123.png is in this location:
http://mysite.com/credits/collectibles/images/image123.png

When really, it is in:
http://mysite.com/images/image123.png

How do i make it so that it doesnt rewrite images, css', js' and all that?

Thanks for reading! :)

~ Andrew
 
Use a hard link to the image.
PHP:
//Instead of this:
<img src="images/image123.png" />
//use:
<img src="http://mysite.com/images/image123.png" />
You can do the same thing with the style sheet too. This is probably the best way to get it to work.
 
Damn you all.

Code:
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^credits/collectibles/$ collectibles.php
 
Back