Page 1 of 1

mod rewrite and urls

Posted: Thu Jan 18, 2007 10:28 am
by KSquared
Im new to creating 'search engine freindly' urls. I am trying to implement the .htaccess method:

<FILES article>
ForceType application/x-httpd-php
</FILES>

I have a link like so: http://www.mysite.com/test/rewrite/article/3/0

Breakdown:
"test" is a directory not a file.
"rewrite" is also a directory not a file.

"article" should be parsed as php.
and '3' and '0' are the values of some parameters.

How do I parse this so it knows to go into directory 'test' then directory 'rewrite' then call article.php and pass the values?
Right now it seems to think that 'test' and 'rewrite' are also values to be passed and not directories. I think....

I guess Im confused as to how to drill down into directories using this method...

My structure:
- rewrite.php lives in the 'test' directory
- article (with no extension) lives in the 'rewrite' directory
- .htaccess also lives in the 'rewrite' directory

Hope this makes sense, any direction would be great!
Thanks in advance

Posted: Thu Jan 18, 2007 11:03 am
by Kieran Huggins
search for "mod_rewrite" and you'll find the answers you seek

Posted: Thu Jan 18, 2007 11:21 am
by aaronhall
What I would do is have mod_rewrite direct to a single file for all requests, typically in the root directory, parse the request URI, and include the necessary files for the request. This tutorial covers how to accomplish it.