WPIntell

Source evidence

URL Encode the redirect_parameter

Simple Page Access Restriction · support · 2024-07-12T01:42:00+00:00

mixedsentiment
mediumseverity
0.84relevance
3replies
Evidence onlycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

1 / 1 rows with source links

100.0% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

0 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
tych095 resolved
I’m trying to redirect to a URL that includes query parameters, but it seems like anything after the & in the redirect URL gets stripped out. I think its because the redirect URL needs to be urlencoded(). e.g., in simple-page-access-restriction.php:172, if we add urlencode() to the home_url() .$_SERVER[‘REQUEST_URI’], it preserves the parameters. $redirect_url = add_query_arg( $settings[‘redirect_parameter’], urlencode(home_url() . $_SERVER[‘REQUEST_URI’]), $redirect_url ); Hi @tych095 , We have tested this and it is working fine when using query parameters in the URL. Could you please provide more details? eg. current settings and URL. Also, if you could deactivate all other plugins and switch to a standard theme to confirm there are no conflicts. Let us know please if that helps. Thank you. Hi, I setup a clean install of wordpress and configured as follows: Login Redirect Type: URL Login Redirect URL: /wp-login.php I then set the Privacy-Policy page to be for logged in users only When I try to access the URL with query parameters: http://wordpress.test/privacy-policy/?var1=1&var2=2 it redirects to http://wordpress.test/wp-login.php?redirect_to=http://wordpress.test/privacy-policy/?var1=1&var2=2 which looks fine, however after logging in, the redirect takes me to http://wordpress.test/privacy-policy/?var1=1 Which is missing var2 query parameter Hi @tych095 , Ah, now we understand your use case and agree with your suggestion. Thank you for bringing this to our attention and for providing the detailed steps to replicate it. We have released a new version of the plugin with this fix. Could you please check the latest release and confirm if it works fine now? Thank you.

Comments

3 shown
Plugins and Snippets 2024-07-23T21:19:00+00:00

Hi @tych095 , We have tested this and it is working fine when using query parameters in the URL. Could you please provide more details? eg. current settings and URL. Also, if you could deactivate all other plugins and switch to a standard theme to confirm there are no conflicts. Let us know please if that helps. Thank you.

tych095 2024-07-28T00:41:00+00:00

Hi, I setup a clean install of wordpress and configured as follows: Login Redirect Type: URL Login Redirect URL: /wp-login.php I then set the Privacy-Policy page to be for logged in users only When I try to access the URL with query parameters: http://wordpress.test/privacy-policy/?var1=1&var2=2 it redirects to http://wordpress.test/wp-login.php?redirect_to=http://wordpress.test/privacy-policy/?var1=1&var2=2 which looks fine, however after logging in, the redirect takes me to http://wordpress.test/privacy-policy/?var1=1 Which is missing var2 query parameter

Plugins and Snippets 2024-07-31T17:49:00+00:00

Hi @tych095 , Ah, now we understand your use case and agree with your suggestion. Thank you for bringing this to our attention and for providing the detailed steps to replicate it. We have released a new version of the plugin with this fix. Could you please check the latest release and confirm if it works fine now? Thank you.