Mod Rewrite / htaccess Help

nick-harper

New member
Hi Guys,

I am trying to make it so that my blog can be found at domain.com/blog/ and then the posts are domain.com/blog/blog-title/

I have used the below code but it doesn't seem to work:

Code:
RewriteRule ^blog/([a-z_0-9-]*)/([a-z_0-9-]*)$ blogpost.php?first=$1&second=$2 [L]
RewriteRule blog blog.php
 


Try this..

Code:
RewriteOptions inherit
RewriteEngine on

RewriteRule ^blog/([a-z_0-9-]+)/([a-z_0-9-]+)$ blogpost.php?first=$1&second=$2 [L]
RewriteRule ^blog$ blog.php [L]

If it's wordpress you don't need to go through changing the .htaccess it can do it for you.
 
Why dont you just install the guts of it into /blog, fire it up, and then set permalinks or whatever you call it in that.

You really should not have to force it with htaccess. And if you switch to Wordpress you can do what i said above easy.
 
Code:
RewriteRule ^blog/([a-z_0-9-]+)/([a-z_0-9-]+)$ blogpost.php?first=$1&second=$2 [L]
RewriteRule ^blog/$ blog.php [L]

You didn't say you wanted /blog/

That's the code to do it above so try that.
 
Maybe the second slash in the blog post:

Code:
RewriteEngine on

RewriteRule ^blog/([a-z_0-9]+)-([a-z_0-9]+)/$ blogpost.php?first=$1&second=$2 [L]
RewriteRule ^blog/$ blog.php [L]
 
Well, let's try to debug and simplify.
Replace '+' with '*' and add the Passthru flag to the rule (if you access the page without http:// in the URL).

Code:
RewriteEngine on

RewriteRule ^blog/([^/]*)-([^/]*)/$ blogpost.php?first=$1&second=$2 [PT,L]
RewriteRule ^blog/$ blog.php [L]