Htaccess [SOLVED]: Re-Routing Query String in PHP Home › Forums › htaccess › Htaccess [SOLVED]: Re-Routing Query String in PHP Tagged: .htaccess, php, routing Viewing 2 posts - 1 through 2 (of 2 total) Author Posts January 4, 2018 at 2:09 am #36965 Anonymous Question I have a website that has many URLs that look like this: https://www.website.com/view?id=56 https://www.website.com/category?name=music Which I would like to look like this: https://www.website.com/view/56 https://www.website.com/category/music This website is deep into development and it is too late to switch to a framework that makes this simpler. My question is: What is the simplest way to do this (again, without using Klien or Composer, or any other framework-type things)? Perhaps something in .htaccess or something along those lines. Thanks! Eric January 4, 2018 at 2:09 am #36966 Anonymous Answer You can enable mod_rewrite in your apache config and rewrite what you want with some rules. Try this ones: RewriteEngine on RewriteRule ^view/([0-9-]+)/?$ view?id=$1 [NC] RewriteRule ^category/([A-Za-z0-9-]+)/?$ category?name=$1 [NC] Source: https://stackoverflow.com/questions/48016598/re-routing-query-string-in-phpAuthor: jeprubioThis work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Author Posts Viewing 2 posts - 1 through 2 (of 2 total) You must be logged in to reply to this topic.