沒錯,只是URL重寫。我使用的Symfony 1.3此刻,他們htaccess的是這樣的:
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase/
# we skip all files with .something
#RewriteCond %{REQUEST_URI} \..+$
#RewriteCond %{REQUEST_URI} !\.html$
#RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
在這種情況下,只要你的index.php控制器,你可以得到這個虛擬主機發送給它的所有URL。簡單!
_「我知道一個Web服務的查詢字符串應該看起來像多於1」 - 爲什麼? – Halcyon 2012-04-27 20:12:17
我真的看不到方便,但它被許多人稱爲更優雅,它是某種方式來做到這一點......但是,這只是一個URL重寫規則?我認爲不,我只是不知道這應該如何工作... – Mattia 2012-04-27 20:18:37
這是REST Api的工作方式,url/resource_name/id。 Btw服務器端(其餘服務器)和客戶端URL由許多現有的軟件處理。例如我使用CodeIgniter Rest服務器來處理客戶端的請求和Backbone.js。雖然你可以(如果你想)通過GET/POST/DELETE/PUT – kernelpanic 2012-04-27 20:33:26