I'm using Apache's mod_rewrite to do some internal URL redirection on a blog engine I'm making.
This is the behavior I want:
/blog/ <-- viewing the blog
/blog/post/ <-- form to make a new post
/blog/x/ <-- redirects to /blog/index.php?title=x
/blog/tag/y/ <-- redirects to /blog/index.php?tag=y
I can get it all working fine if that second line is left out with these statements:
That successfully makes post/ an exception, but /blog/tag/y ends up as /blog/index.php?title=/blog/index.php/y
What is the correct way to write this? Thanks in advance!
Your second rule seems... off...
RewriteRule ^tag/(.*)/$ index.php?tag=$1 [L]
RewriteRule ^(?!post/)(.*)/$ index.php?title=$1
Tip: the [L]ast flag tells Apache to stop processing other rules.
[edit] Apparently you want trailing /s. Personally I don't like enforcing them, but whatever.
Your second rule seems... off...
RewriteRule ^tag/(.*)/$ index.php?tag=$1 [L]
RewriteRule ^(?!post/)(.*)/$ index.php?title=$1
Tip: the [L]ast flag tells Apache to stop processing other rules.
[edit] Apparently you want trailing /s. Personally I don't like enforcing them, but whatever.