.htaccess problem with non-full-path requests

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
blunder
Forum Newbie
Posts: 1
Joined: Sat Mar 31, 2007 5:11 pm

.htaccess problem with non-full-path requests

Post by blunder »

Basically I am trying to have articles/category/article.php to pump to another file as indicated with the rewrite below.

RewriteRule articles/(.*)/(.*).php /articles.php?cat=$1&article=$2

The problem is that I still want a request that i would ideally like that also requests where only category is given, but no article id, also are handled by the script. It would be great if there is a way to do this in the .htaccess, but otherwise. Could someone recommend how I would do it using PHP? I mean, I could probably somehow make the .htaccess point every articles* request to the articles.php, right?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

not sure exactly what you're after here, but I think you just need another rewrite rule:

Code: Select all

RewriteRule articles/(.*?)/? /articles.php?cat=$1
Post Reply