Solved

Mod rewrite problem

Posted on 2008-10-06
4
191 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Google Fonts cannot be displayed with Firefox and Internet Explorer 6 262
phpmyadmin installation 3 60
htaccess restrict subdomain 4 112
phpPgAdmin problem 14 134
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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