如何在htaccess中为斜杠分隔的url参数创建Generic RewriteRule?

时间:2016-12-04 09:45:34

标签: apache .htaccess

我想从url中获取我的数据,像这样斜线分开:

  

www.example.com/page.php/12

巫婆必须解释为:

  

www.example.com/page.php?id=12

我不会指定页面名称,例如" page.php"在我的.htaccess中它必须是通用的,如" * .php"。 我使用这行,但这改变了我的baseUrl和我的CSS无法访问:

RewriteEngine On
RewriteRule ^([^/]+)/([^/]+)$  $1.php?id=$2

0 个答案:

没有答案