首页 > 解决方案 > PHP 变化?从网址到 /

问题描述

我想更改 PHP http://localhost/dispatch.php?category=lupa&id=1(或任何整数)中的链接我在互联网上发现了很多 htacces 但它不是动态的。我有 10-20 页和 1-5 个参数/链接。在互联网上,只有 index.php 的 htacces 和 1 个参数。我想要一个动态的 htacces,应用于所有页面和所有参数,比如 laravel 路由。

标签: phpurlrouting

解决方案


你可以这样写:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /dispatch.php?category=$1&id=$2 [L]

推荐阅读