clean-urls

Remove .php extension with PHP

别来无恙 提交于 2019-11-26 06:08:10
问题 I could use some help here. I\'m using this to fix my URL but I can\'t figure out how to remove the .php extension. The URL looks like this now: http://mydomain.com/page.php/foo/123/bar/456 function decode_URL_parameters() { $path = @$_SERVER[\'PATH_INFO\']; $url_array=explode(\'/\',$path); array_shift($url_array); while ($url_array) { $_GET[$url_array[0]] = $url_array[1]; array_shift($url_array); array_shift($url_array); } } Any ideas? /Tobias 回答1: If you're serving via Apache, you'll want

How to version REST URIs

断了今生、忘了曾经 提交于 2019-11-26 02:26:53
问题 What is the best way to version REST URIs? Currently we have a version # in the URI itself, ie. http://example.com/users/v4/1234/ for version 4 of this representation. Does the version belong in the queryString? ie. http://example.com/users/1234?version=4 Or is versioning best accomplished another way? 回答1: I would say making it part of the URI itself (option 1) is best because v4 identifies a different resource than v3. Query parameters like in your second option can be best used to pass-in