This might seem like a very easy answer but I cant seem to wrap my head around it. How would I rename files? For instance if I wanted to rename index.php to “home” or something. How would I go about doing that?
Also, how would I rename user pages? Instead of example.com/profile.php?id=28, something like example.com/users/mrexample
Thanks a bunch guys!
Assuming you want to keep the existing file structure on the server and present pretty URLs as you described, this is called URL Routing. If you’re using Apache then
mod_rewriteis the way to go. Lighttpd also supports rewrites. I believe a commercial rewrite plugin is available for IIS.You can either create a set of rewrite rules that match URL queries and pass them on to the relevant PHP file, or have a single rewrite rule that forwards all requests to a single PHP script which calls the appropriate function/script/template/include.
Hope that helps