[英].htaccess - Convert PHP GET to URL Path but keep GET in URL
My Goal was to redirect a URL like http://example.com/c/themeforest/wordpress
to the PHP http://example.com/?params=c/themeforest/wordpress
. 我的目标是将类似
http://example.com/c/themeforest/wordpress
的URL重定向到PHP http://example.com/?params=c/themeforest/wordpress
。
To achieve this, I used a .htaccess file with the following contents: 为此,我使用了.htaccess文件,其内容如下:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?params=$1 [NC]
But now I have to also be able to redirect URLs like http://example.com/c/themeforest/wordpress?p=2
to http://example.com/?params=c/themeforest/wordpress&p=2
for multiple Pages. 但是现在我还必须能够将多个URL(例如
http://example.com/c/themeforest/wordpress?p=2
重定向到http://example.com/?params=c/themeforest/wordpress&p=2
页面。
The Page Number has to be sent in a seperate PHP GET Variable. 页码必须在单独的PHP GET变量中发送。
添加QSA(查询字符串追加)标志,因此:
RewriteRule ^(.*)$ index.php?params=$1 [NC,QSA]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.