0

I'm stuck and I don't know how to create friendly urls rewriting and redirecting my php urls. I would actually like to convert this url structure:

www.mywebsite.com/blog/post.php?id=myid&year=2018&titleurl=my-perfect-title

into this:

www.mywebsite.com/blog/my-perfect-title

And of course all the users and search engine have to see only this last one.

Can anybody help?

Thank you.

Karlo Kokkak
  • 3,674
  • 4
  • 18
  • 33
  • 1
    What have you tried? There are already many questions (and answers) on this topic. Just a short list: [this](https://stackoverflow.com/questions/812571/how-to-create-friendly-url-in-php), [this](https://stackoverflow.com/questions/6002203/seo-friendly-url), and [this](https://stackoverflow.com/questions/11303949/friendly-urls-using-rewrite-in-htaccess) – Patrick Q May 11 '18 at 18:08
  • 1
    You have more than 1 dynamic value, how do you expect the others to be sent? – Lawrence Cherone May 11 '18 at 18:10
  • Could use `/blog/BQmUDDr/my-perfect-title`, if you [hash](https://hashids.org/) them ids into one param: https://codepen.io/anon/pen/KRRZoL - Then serverside decode them back into the params, or put up with `/blog/123/2018/my-perfect-title` – Lawrence Cherone May 11 '18 at 18:17
  • All the questions found are quite different and include other parameters... I'd like to have a short link rewrited without year and id but only with the seo title. Is this possible? – ClaudioM May 11 '18 at 18:18
  • If your page doesn't load from this `www.mywebsite.com/blog/post.php?titleurl=my-perfect-title`, then you're not going to be able to load it from this `www.mywebsite.com/blog/my-perfect-title` without making changes to the code the decides what content to load – Patrick Q May 11 '18 at 18:25
  • Possible duplicate of [How to create friendly URL in php?](https://stackoverflow.com/questions/812571/how-to-create-friendly-url-in-php) – fabianvf May 11 '18 at 20:22

0 Answers0