使用$_SERVER["SCRIPT_URI"]
代替$_SERVER["REQUEST_URI"]
:
...
$mpage = $_GET['mpage'];
...
$currpage = $_SERVER["SCRIPT_URI"];
...
编辑和编辑 2:固定 $mpage 变量名
更新
问题在于重写,您需要将 QSA 标志添加到所有重定向以“保留”mpage
参数:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule ^$ index.php [QSA,L]
RewriteRule ^admin/?$ admin/index.php [QSA,L]
RewriteRule ^admin/(.*)$ admin/index.php?page=$1 [QSA,L]
RewriteRule ^(.*)/(.*)$ index.php?lang=$1&page=$2 [QSA,L]
RewriteRule ^(.*)$ index.php?lang=en&page=$1 [QSA,L]