Page 1 of 1

.htaccess problem with non-full-path requests

Posted: Sat Mar 31, 2007 5:23 pm
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?

Posted: Sun Apr 01, 2007 5:00 am
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