Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Rewrite rule confusion

I'm trying to convert a simple url (below) in to a blog-style url, but not quite sure how to do it, all of my other rules are working fine, but I can't seem to figure this one out.

URL I want to convert: http://www.website.com/myblog.php?id=1&title=My+blog+title

URL I want it to create: http://www.website.com/1/my-blog-title

What should the rule be?

Any assistance appreciated :)

like image 597
Lee Avatar asked Mar 30 '26 04:03

Lee


1 Answers

Try this

RewriteEngine on
RewriteBase /
RewriteRule ([0-9]+)/([^.]+) myblog.php?id=$1&title=$2
like image 108
Lizard Avatar answered Apr 02 '26 14:04

Lizard