Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8459131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:15:39+00:00 2026-06-10T13:15:39+00:00

I am trying to redirect a login page to an external security service. This

  • 0

I am trying to redirect a login page to an external security service. This service, after validating the credentials, will then return user back to the originating page using the referrer url, as in the following example:

http://{IP NUMBER}/MyWiki/index.php?title=Special:UserLogin&returnto=Main_Page

or any call to a page in the site containing Special:UserLogin in the query_string needs to be redirected to:

https://login.security.server.com/test/UI/Login?service=DSSEC&goto=http://{IP NUMBER}/MyWiki/index.php/Special:UserLogin

I have been testing with RewriteCond and RewriteRule without any luck.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:15:40+00:00Added an answer on June 10, 2026 at 1:15 pm

    You want something like this?

    RewriteEngine On
    RewriteCond %{REQUEST_URI} Special:UserLogin [OR]
    RewriteCond %{QUERY_STRING} Special:UserLogin
    RewriteCond ?#%{QUERY_STRING} ([^#]+)#([^#]+)
    RewriteRule ^ https://login.security.server.com/test/UI/Login?service=DSSEC&goto=http://%{SERVER_ADDR}%{REQUEST_URI}%1%2 [L,B,NE]
    

    Ok, this is going to seem a little confusing, but here’s what’s going on.

    1. Check if Special:UserLogin is in the request URI or the query string.
    2. Create backreference matches for the ? mark, the URI and the query string (this is very important)
    3. Redirect the request to https://login.security.server.com/test/UI/Login, but using the back references from the previous condition to build the goto= param, and using the B flag, which URL encodes the backreferences. This way, the result is an entire URL, along with query string, that’s been URL encoded. (The NE flag is there to make sure the % signs themselves don’t get double encoded).

    With these rules, a request for:

    /MyWiki/index.php?title=Special:UserLogin&returnto=Main_Page
    

    Will get redirected to:

    https://login.security.server.com/test/UI/Login?service=DSSEC&goto=http://123.45.67.89/MyWiki/index.php%3ftitle%3dSpecial%3aUserLogin%26returnto%3dMain_Page
    

    As you can see, the query string ?title=Special:UserLogin&returnto=Main_Page gets encoded into %3ftitle%3dSpecial%3aUserLogin%26returnto%3dMain_Page, so that the login.security.server.com doesn’t mistake it for its own query string. Instead, their login service will see the goto parameter as:

    http://123.45.67.89/MyWiki/index.php?title=Special:UserLogin&returnto=Main_Page
    

    entirely intact.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to redirect people to the page they came from after they login.
I am trying to redirect automatically to my login page after session times out.
I'm trying to check if $this->current_user is set, otherwise redirect to the login page
I am trying to redirect Spring Security to a custom login page which GWT
Basically, I'm trying to redirect people who aren't logged in to the login page.
I'm trying to redirect users that login to their profile page but get the
This is probably one of those easy questions.. I'm trying to redirect the user
I have been trying to make a user login page that, when the user
So I'm trying to get a page to submit to itself and then redirect
I'm trying to do this: Make spring security add the return to url in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.