English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi,

I installed PHP on Windows XP, the address of my website: http://localhost/mywebsite/. Following is what I typed in .htaccess:

RewriteEngine On
RewriteRule ^([a-z]+)/?$ ?page=$1

If I type "http://localhost/mywebsite/something", everything is fine. However, if I type "http://localhost/mywebsite/something/" (with a slash at the end), all images on my webpage disappeared. I found that I need to modify the address to image directory from "/images" to "http://localhost/mywebsite/images" in all of *.html files to make "http://localhost/mywebsite/something/" work.

Anyone can explain? Thank you in advance.

Liem Do

2007-03-22 18:37:26 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

Let's say you have a link to an image in your script:



If you request your script as /mywebsite/somepage, the HTTP server views this request as a request for page somepage located in the mywebsite directory, so it looks for the image.jpg in the mywebsite directory.

If, however, you request your script as /mywebsite/somepage/, the HTTP server views this request as a request for the index page in the mywebsite/somepage directory and looks for the image.jpg in the mywebsite/somepage directory, which, needless to say, does not exist.

2007-03-23 15:24:50 · answer #1 · answered by NC 7 · 1 0

Mod rewrite rewrites everything so /images becomes relative to the rule and not the referrence you want. Thus your link has to be absolute. You can write another rule to keep from doing that (but I can't find the referrence to it at the moment.)

2007-03-26 19:30:06 · answer #2 · answered by Tracy L 7 · 0 0

fedest.com, questions and answers