I've got a small problem with my HTaccess urls. I wanted to make my URLs more SEO friendly, my current URL is:
url.com/blogitem/2
url.com -> Domain ; blog -> blogitem.php ; 2 -> ID for the blog item to get from the DB
Now I would like the URL to be like this:
url.com/blogitem/2/name-title-info
I've made the HTaccess part and the PHP part for it, but it will give me a 404 error page in return every time I visited the URL.
The HTaccess part:
# Blog SEO Urls.
RewriteRule ^blog/([0-9]*)/?$ blog.php?page=$1 [NC,L]
RewriteRule ^blogitem/([0-9]*)/?$/([a-z]*)/?$ blogitem.php?id=$1&name=$2 [NC,L]
The PHP part:
$trancTitle = trim(strtolower($blogTitle));
$underscoreTitle = preg_replace('/\s+/', '-', $trancTitle);
<a href="blogitem/<?php echo $blogId; ?>/<?php echo $underscoreTitle;?>">
Can someone explain why I'm getting an error page in return(404 to be exactly). I'm sorry for my bad English, it isn't my mother tongue. Thanks for helping in advance!