views:

108

answers:

0

Okay so I'm rewriting a URL domain.com/id/text to domain.com/page.php?id=id using mod_rewrite / htaccess

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^webresauce.com [nc]
RewriteRule ^(.*)$ http://www.webresauce.com/$1 [r=301,nc]

# Rewite URL Starts here
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ read-post.php?id=$1&n=$2 [QSA,L]

It does what it's supposed to except images and links all think they're in the folder domain.com/id/ - they obviously aren't. I want to avoid using a full URL for the images etc so I don't need to change my developing URLs and Live URLs among other things.

Is there anyway using htaccess I can make it so it gets the files from the base directory not the non-existant one.

This: http://www.webresauce.com/5712/gfhhdfg

Should look like this: http:// www.webresauce.com/read-post.php?id=5712 (remove space after http://)

Any help would be much appreciated