Solved

Mod rewrite problem

Posted on 2008-10-06
4
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 22655347
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
ID: 31503583
Thanks a lot
0
 

Author Comment

by:GenTaliaru
ID: 22656996
Can you explain me what         

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

Expert Comment

by:caterham_www
ID: 22657645
.  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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 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