1

I'm trying to direct a url for a blog post to a PHP page that takes a GET var using htaccess.

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/post/(\w+)$ blog/post.php?title=$1 [QSA,L]

However, this just gives me a 404. I have confirmed that /blog/post.php?title=my-postis a valid url.

smulholland2
  • 1,143
  • 2
  • 14
  • 28

1 Answers1

1

Since your title contains hyphens your rule should allow it:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/post/([\w-]+)$ blog/post.php?title=$1 [QSA,L,NC]
anubhava
  • 761,203
  • 64
  • 569
  • 643