我已经从以下网址重写了网址:例如
https://website.com/search.php?number=00000000000
到以下:
https://website.com/number/00000000000
但是现在我希望将?success = 1传递给我重写的URL。但是它只是重定向而忽略了它:
例如
https://website.com/number/00000000000?success=1
到
https://website.com/number/00000000000
我该如何实现?
这是我的htaccess文件
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [R=301,QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_URI} \.(jpg|css|js|gif|png)$ [NC]
RewriteRule ^ - [L]
#unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]
#resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
#redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.#?\ ]+\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.php /$1 [R=301,L]
RewriteRule ^number/([^/]*)$ /search.php?number=$1 [L,QSA]
答案 0 :(得分:3)
我的错,我正在执行标头位置重定向,而不是在重定向中附加和查询参数