我对 htaccess 有问题,而且不太擅长。我想知道如何使网址干净。
这里是原文
我想要这种类型的网址
如果我要从数据库中获取$_get它,我如何获得index1/index2的p 值?
我对 htaccess 有问题,而且不太擅长。我想知道如何使网址干净。
这里是原文
我想要这种类型的网址
如果我要从数据库中获取$_get它,我如何获得index1/index2的p 值?
该模式([^/]+)匹配所有内容,但不包括/into $1,其余部分被捕获(.*)into $2。
RewriteEngine On
# Don't rewrite real existing files & directories (like css,js,img)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Add .php to the first group (like page.php) and stick the rest into p
RewriteRule ^([^/]+)/(.*)$ $1.php?p=$2
在 PHP 内部,检索pvia 的值:
$_GET['p']