mod rewrite and urls

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
KSquared
Forum Commoner
Posts: 25
Joined: Tue Aug 29, 2006 4:07 pm

mod rewrite and urls

Post 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
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

search for "mod_rewrite" and you'll find the answers you seek
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
Post Reply