Solved

Mod rewrite problem

Posted on 2008-10-06
4
190 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:GenTaliaru
  • 2
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
Comment Utility
You can redirect the folder WWW_files to the root level with the code below. Another approach: Modify your HTML source code to

src="/WWW_files/img.jpg/" (leading slash) or with

<base href="http://example.com/">  in your <head>....</head> section of a html page.
RewriteRule .(/WWW_files/.*)$ $1 [R=301,L]

Open in new window

0
 

Author Closing Comment

by:GenTaliaru
Comment Utility
Thanks a lot
0
 

Author Comment

by:GenTaliaru
Comment Utility
Can you explain me what         

RewriteRule .(/WWW_files/.*)$ $1 [R=301,L] means?
0
 
LVL 27

Expert Comment

by:caterham_www
Comment Utility
.  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.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now