Problem with paths after rewriting urls

Hi,

I was just rewriting the URLs of my site to search engine friendly ones using the PATH_INFO method (by sitepoint advice <= the first method ), so my URLs would look like example.com/article.php/beach-volley instead of example.com/article.php?id=beach-volley. However, I came across another problem: the browser won’t display images that are in the root directory or in a folder of the root directory (ex. pic/ball.jpg) and the links won’t work any more either. When I click on them, instead of example.com/matches.php it goes to example.com/article.php/beach-volley/matches.php, which obviously doesn’t exist.

Is there any easy way around this?

Thanks a lot :slight_smile:

Okay, I think I figured it out, I just have to use absolute paths to files instead of relative…

vaj,

I’m not sure what that link told you to do (presumably using mod_rewrite) but, if you want to learn about mod_rewrite, you might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.

In that tutorial, I discussed how changing directory levels with the mod_rewrite can destroy relative links. I offered two solution with the least desirable one being to require absolute links throughout. The preferred solution is to use HTML’s <base> tag.

I see, though, that you SHOULD have other problems with your links as using a file in a directory position in the path requires the use of MultiViews - something which has caused many problems for members over the years. To see what can (IMHO, what SHOULD) be done with article titles, have a look at http://wilderness-wally.com where I use a single file (like your article.php) to handle all the incoming links (and Wally’s created dozens!). There are no MultiView problems at Wally’s website.

Oh, to answer your question, WW’s website returns the Home Page (Welcome) when bad input is provided. There is a bit about this in my signature’s tutorial but I don’t generally elaborate (unless via PM - details can be sensitive).

Regards,

DK