I have the following modrewrite rule:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^blog/([^/]*)/([^/]*)/$ /blog.php?date=$1&title=$2 [L]
Which is pretty straightforward. My question is, how do I get this rewrite to direct to blog.php
if no variables are listed?
blog.php is written to both produce the article listing if no variables are present, and also to create the individual listing if one is present.
Edit:
blog.php works fine without mod rewrite. If I go to http://host/blog.php
it lists all my articles. If I go to http://host/blog/2010-10-05/blog-title/
it shows my single entry. Similarly, if I go to http://host/blog.php?date=2010-10-05&title=blog-title
I get a single entry. However, I want http://host/blog/
to list all my entries as well.
I guess the question is: Does this require a second rewrite rule? And if so, how do I get the two to play nice.
Which is pretty straightforward. My question is, how do I get this rewrite to direct to blog.php if no variables are listed?
care to make an example ? not entirelly sure i understood your point... From what i understood it seems more like a programming issue then a rewrite rule issue. It would be a blog.php programming thing to instead of trying to show the article to show something else when there is no available article on the given variables.RewriteRule ^(blog|blog/)$ /blog.php [L]
which would come before your other rule.