WPIntell

Source evidence

?redirect_to is not working

LoginPress | wp-login Custom Login Page Customizer · support · 2024-12-16T23:44:00+00:00

mixedsentiment
highseverity
0.95relevance
3replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

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

4 / 28 rows with source links

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

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

24 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
chelminski resolved
Hi 😀 I noticed that when I use the plugin, the redirection from the parameter does not work. For example, when I go to the address: https://mywebsite.com/login?redirect_to=https://google.com I am still redirected to the administration panel. Is it possible for the plugin to force redirection when this parameter is set during login? Greetings, chelminski Hi @chelminski , That’s the default behavior of WordPress to redirect subscribers to the administration panel (wp-profile.php). LoginPress has a paid add-on, Login Redirects , to control redirects after login and logout for specific users and roles. You can learn more about this add-on here . Hi 😀 From what I understand, I can set permanent redirects using a plugin add-on. The problem is that the “?redirect_to” parameter is always different. I don’t want to set the redirection relative to the role, but to have it done dynamically. Unfortunately, after activating your plugin, the native redirect function of the “?redirect_to” parameter doesn’t work in WordPress. 🙁 Greetings, chelminski Hi Unfortunately or fortunately 😀, I found no such issue with redirect_to parameter on my end. It is working fine with LoginPress installed. For example, I used /wp-login.php?redirect_to=hello-world . After logging in, I was redirected to the Hello World post. Let me explain to you how the redirect_to parameter works in WordPress. WordPress enforces strict validation rules for security reasons, which can affect how the redirect_to parameter behaves based on the URL format. Relative vs Absolute URLs in redirect_to If you use a relative URL like /hello-world in the redirect_to parameter, WordPress appends this to the site’s base URL (as configured in Settings → General ). For example: Login URL : /wp-login.php?redirect_to=/hello-world After login, WordPress will redirect to: https://your-site.com/hello-world If you use an absolute URL, such as https://your-site.com/hello-world , WordPress validates the domain, protocol, and structure of the URL. WordPress redirects the user to the WordPress admin dashboard if the absolute URL doesn’t match the site’s domain or fails validation . Example with Encoded URL If your login URL looks like this: https://your-site.com/wp-login.php?redirect_to=https%3A%2F%2Fyour-site.com%2Fhello-world Here’s what happens: The redirect_to parameter is URL-encoded and specifies the absolute URL: https://your-site.com/hello-world/ . WordPress decodes and validates the redirect_to URL. Since the domain and protocol match the WordPress site settings, the URL is considered safe. After a successful login, the user is redirected to the specified URL. This format works because: The redirect_to URL matches the site’s domain and protocol exactly. It is properly URL-encoded (e.g., : becomes %3A , / becomes %2F ). Therefore, if your redirection is not working properly, it might be due to a mismatch in domain or protocol or improper encoding. I hope this information was helpful! 🙂 If you are still facing any issues, please contact us on our support forum so we can help you fix the problem on your site.

Comments

3 shown
Emma 2024-12-17T10:46:00+00:00

Hi @chelminski , That’s the default behavior of WordPress to redirect subscribers to the administration panel (wp-profile.php). LoginPress has a paid add-on, Login Redirects , to control redirects after login and logout for specific users and roles. You can learn more about this add-on here .

chelminski 2024-12-17T18:27:00+00:00

Hi 😀 From what I understand, I can set permanent redirects using a plugin add-on. The problem is that the “?redirect_to” parameter is always different. I don’t want to set the redirection relative to the role, but to have it done dynamically. Unfortunately, after activating your plugin, the native redirect function of the “?redirect_to” parameter doesn’t work in WordPress. 🙁 Greetings, chelminski

Emma 2024-12-18T08:37:00+00:00

Hi Unfortunately or fortunately 😀, I found no such issue with redirect_to parameter on my end. It is working fine with LoginPress installed. For example, I used /wp-login.php?redirect_to=hello-world . After logging in, I was redirected to the Hello World post. Let me explain to you how the redirect_to parameter works in WordPress. WordPress enforces strict validation rules for security reasons, which can affect how the redirect_to parameter behaves based on the URL format. Relative vs Absolute URLs in redirect_to If you use a relative URL like /hello-world in the redirect_to parameter, WordPress appends this to the site’s base URL (as configured in Settings → General ). For example: Login URL : /wp-login.php?redirect_to=/hello-world After login, WordPress will redirect to: https://your-site.com/hello-world If you use an absolute URL, such as https://your-site.com/hello-world , WordPress validates the domain, protocol, and structure of the URL. WordPress redirects the user to the WordPress admin dashboard if the absolute URL doesn’t match the site’s domain or fails validation . Example with Encoded URL If your login URL looks like this: https://your-site.com/wp-login.php?redirect_to=https%3A%2F%2Fyour-site.com%2Fhello-world Here’s what happens: The redirect_to parameter is URL-encoded and specifies the absolute URL: https://your-site.com/hello-world/ . WordPress decodes and validates the redirect_to URL. Since the domain and protocol match the WordPress site settings, the URL is considered safe. After a successful login, the user is redirected to the specified URL. This format works because: The redirect_to URL matches the site’s domain and protocol exactly. It is properly URL-encoded (e.g., : becomes %3A , / becomes %2F ). Therefore, if your redirection is not working properly, it might be due to a mismatch in domain or protocol or improper encoding. I hope this information was helpful! 🙂 If you are still facing any issues, please contact us on our support forum so we can help you fix the problem on your site.