更新时间:2023-02-24 10:54:39
所有你需要的是一次重写:
All you need is one rewrite:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?route=$1 [L,QSA]
然后在您的index.php文件的分裂路线为piecies:
then in your index.php file your split the route into piecies:
$route = (!isset($_GET['route']))?'':$_GET['route']);
$parts = explode('/', $route);
So your old urls like this:
index.php?page=home
index.php?page=about&content=about-news&id=27&pn=1
index.php?page=$1
index.php?page=$1&content=$2
Become:
Example: `http://example.com/controller/action/do/value`
or `http://example.com/$parts[0]/$parts[1]/$parts[2]/$parts[3]/$parts[4]`
保持到控制器 - >行动 - >做 - >思想价值的简单分配路线。
Keeping to the idea of controller->action->do->value its easy to assign routes.
?页=
将您的控制器
?内容=
将您的操作
ID =
将您的子动作|做|值等