我正在建立一个网站,并希望实施一个邀请计划。我想这样做,如果用户转到https://example.com/invite/code,它会重定向到https://example.com/?rc=code。下面是我目前的htaccess,我不能让新代码干扰。谢谢!
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteRule (.*)\.php$ /$1 [R=301,L,QSA,NC]
答案 0 :(得分:0)
假设原始网址不包含您要保留的查询字符串:
RewriteRule ^invite/(.*)$ "/?rc=$1" [PT]