0

I am having difficulty in how to proceed in making a website that uses a RESTful URL architecture. There are a lot of website tutorials saying that they have made a RESTful URL and what more you can do but none of them go into detail as to how they have managed to go from:

example:

www.mywebsite.co.uk/properties.php?id=235

to

www.mywebsite.co.uk/properties/235

My understanding of the URL is that it is a path to the file being used, e.g. The properties.php file is being used above. But how can I get the second URL above without explicitly making a properties folder and then a file named 235?

What is the best way of achieving this and/ or the best API to use?

This has been boggling my mind for a while now and there doesn't seem to be a simple - do this - answer to the question.

  • Something like the Symfony framework makes that easy. Other options might include related frameworks like Yii. They use the concept of "routes" to create those kinds of friendly URLs for everything from JSON endpoints to file downloads. – SomeDude Dec 07 '16 at 20:23
  • An interesting [article](http://stackoverflow.com/questions/16388959/url-rewriting-with-php) I found using the [magic oogle](http://google.com) – Nytrix Dec 07 '16 at 20:23
  • Is there a way of making your own framework to create the URL verb & action routes? I know frameworks are usually best to use but I'm curious as to how to implement my own – Jonathan Hill Dec 07 '16 at 20:26
  • Thanks all, I'll look into all the articles/ frameworks in more detail. While not directly related does anyone know a good resource for learning to write .htaccess rules? I have never looked into this in-depth – Jonathan Hill Dec 07 '16 at 20:31
  • If htaccess rules are for Apache, their website has pretty thorough documentation – SomeDude Dec 07 '16 at 22:13

0 Answers0