• GoDaddy Community
  • VPS & Dedicated Servers
  • VPS & Dedicated Servers

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 

    using rest style URLs

    I am using old-school URLs on my cPanel website like this:

    http://mydomain.org/widgets/viewer.htm?item=1234

    http://mydomain.org/widgets/viewer.htm?item=1235

    http://mydomain.org/widgets/viewer.htm?item=1236

    In this, one server-side file "viewer.htm" can render information about any item

     

    I would rather address my content like this:

    http://mydomain.org/widgets/1234 or

    http://mydomain.org/widgets/1234/ or

    http://mydomain.org/widgets/1235 or

    http://mydomain.org/widgets/1235/ or

    http://mydomain.org/widgets/1236 or

    http://mydomain.org/widgets/1236/ ...etc.

     

    ...while having all that content be served by a single script, since I certainly don't want to create directories for every possible widget. Also leaving open the possibility for http://mydomain.org/widgets/1236/edit or other similar CRUD use cases.

     

    Where do I start with GoDaddy cPanel in order to get that to work? A REST server? I am assuming that once I have the right "server thingy" then I can write my server-side content in python, ruby or PHP, etc.

     

    1 REPLY 1
    Employee
    Employee

    Re: using rest style URLs

    Without knowing all the details, you may be able to do this without changing your code too much (or perhaps even at all!) using something like mod_rewrite, if you're running on Linux and your server supports it. Just found a great example in this list of different mod_rewrite use cases that sounds pretty similar to what you're trying to do. In their case, they were trying to do this rewrite included below. Sounds like it's in the same ballpark. 

     

    Screen Shot 2016-04-03 at 7.37.47 AM.png