skip to Main Content

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


  1. 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]
    
    Login or Signup to reply.
  2. 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]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search