Link to home
Start Free TrialLog in
Avatar of GenTaliaru
GenTaliaru

asked on

Mod rewrite problem

I have made a rewrite rule
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?id=$1/$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?id=$1/$2

if the url is www.domain.ee/products/product then for the php is url www.domain.ee/index.php?id=products/product
so far ok.
But if the url is www.domain.ee/products/product and i write HTML <img src="WWW_files/img.jpg/">
then the img paht is www.domain.ee/products/product /WWW_files/img.jpg

How can i do this,  no matter how deep is the url (www.domain.ee/1/2/3/4...../199) for the html always get www.domain.ee/WWW_files

I hope you understand my bad english.

but if i write html
ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GenTaliaru
GenTaliaru

ASKER

Thanks a lot
Can you explain me what         

RewriteRule .(/WWW_files/.*)$ $1 [R=301,L] means?
.  one character followed by
/WWW_files/  literally followed by
.*  0 or n characters; capture the matched result within (...)  in a backreference
$ end of string

$1 is the notation of the backreference in the substitution

R=301 forces a redirect with HTTP status code 301
L stands for last rule.