Phalcon - 如何使用 .htaccess 在 URL 中隐藏获取参数

Phalcon - How to hide get parametres in URL with .htaccess

我有一个url喜欢

localhost/case?id=name

如何使用 htaccess 在不路由的情况下隐藏 id 部分并仅显示:

localhost/case/name

p.s。框架 phalcon

htaccess 有:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^((?s).*)$ index.php?_url=/ [QSA,L]
</IfModule>

试一试:

RewriteEngine On
RewriteRule ^case/([^/]*)$ /case?id= [L]

试试这个:

#if our requested file isn't a dir, and isn't a file, and isn't a symbolic link
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
#then skip our next rule below
RewriteRule .* - [S=1]
#since we got here, the file exists, so don't rewrite it, skip the next two rules
RewriteRule .* - [S=2]
#these two rules are bound to our condition i.e. if the link is broken
RewriteRule ^case/([^/]*)$ index.php?_url=/case&id= [QSA,L]
RewriteRule ^((?s).*)$ index.php?_url=/ [QSA,L]
#end of our two rules which would be skipped if our condition was false