How to rewrite multiple parameter URL in .htaccess and core PHP to make it seo friendly

Viewed 71

I am working on a blog, And my current blogpost URL is looking like this

https://myblog.example/blog-inner.php?url=my-awesome-life

Now I want to rewrite this URL to look like

https://myblog.example/blog/catogory/my-awesome-life

Please note: we have a single category for each blog.

So how can we rewrite its URL in .htaccess and what are the procedure to display this blog perfectly?

2 Answers

Here is

RewriteEngine On
RewriteRule ^blog/catogory/([A-Za-z0-9-]+)$ blog-inner.php?url=$1 [QSA,L]
RewriteRule ^blog/catogory/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/$ blog-inner.php?url=$1&something=$2 [QSA,L]

you can try it like this

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Related