0

I'm currently working on a little PHP/JS application, but I'm absolutely not satisfied with the way the URL's look. They are something like domain.com/file.php?id=2&delete=true or something similar...

Now I'm trying to get the URL's in a nicer way, something like domain.com/file/2, leading to the same result. Now I found some little routing plugins, but I don't know if that's the thing I need. Basically I don't really mind about dirty code or whatever, as I'm just trying and learning, but the URL's would really matter to me.

Is there an easy DIY solution for these things or should I use a routing-plugin or what's the best way to do this?

Edit: it's not really a duplicate, I wasn't looking for doing all with htaccess, as this is limited, I'm looking for a PHP-Solution with minimal routing

nameless
  • 1,483
  • 5
  • 32
  • 78
  • Why not use some framework? For example codeigniter? It's lightweight framework, good for small apps. – Marek Zavoronok Jan 01 '19 at 09:37
  • @MarekZavoronok Cause it’s not hard to do yourself, and it helps you learn…? – deceze Jan 01 '19 at 09:38
  • @MarekZavoronok Absolutely agree to deceze, because I'm working on PHP for myself and I want to program as much as possible for myself in order to learn and get better – nameless Jan 01 '19 at 09:42
  • Re “not a duplicate”: the basic idea is to use mod_rewrite to handle URLs independently of physical files. How you “route” afterwards within PHP is up to you. – deceze Jan 01 '19 at 12:30
  • no, not at all. the basic idea is to use php scripts or php routing to handle URL's. – nameless Jan 01 '19 at 12:31
  • Yeah, the first step for that is to rewrite every request to one PHP file using mod_rewrite. If you need more specific help, ask a more specific question. – deceze Jan 01 '19 at 12:53

0 Answers0