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

  • SEARCH
  • Home
  • 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 8132207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:17:19+00:00 2026-06-06T09:17:19+00:00

The webserver i’m using is Apache 2.2. I’m trying to validate a domain that

  • 0

The webserver i’m using is Apache 2.2. I’m trying to validate a domain that is in a query string sent by an external party.

An example of a valid request:
https://something.example.com/aaa/bbb/ccc?returnurl=https://test.example.com/home

examples of invalid requests:

  1. scheme://something.example.com/aaa/bbb/ccc?returnurl=https://something.evil.com/home
  2. scheme://something.example.com/aaa/bbb/ccc?returnurl=http://www.google.com
  3. scheme://something.example.com/aaa/bbb/ccct?returnurl=https://something.evil.com/blah?url=https://test.example.com/home

So far in my httpd.conf file I have:

    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^/aaa/bbb/ccc$
    RewriteCond %{QUERY_STRING} !(\.|https://|http://)example\.com(\.|/)|(\.|https://|http://)exampledev\.com(\.|/) [NC]
    RewriteRule ^(.*) / [R=403,L]

The above code basically looks at the query string and redirects the user to a forbidden page if example.com and exampledev.com is NOT in query_string.

This code is only doing part of the job as invalid request number 3 will be considered as containing example.com, which could be considered a phishing attack

Somehow I need to validate the domain that is returned in query_string returnurl.

The string between http:// or httpd:// a .com or .net or .org or any other top level domains.

Can someone please help or suggest how I would validate a domain that is returned as a returnurl query string?

  • 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-06T09:17:20+00:00Added an answer on June 6, 2026 at 9:17 am

    Use the following:

    RewriteEngine On
    
    RewriteCond %{REQUEST_URI} ^/aaa/bbb/ccc$
    RewriteCond %{QUERY_STRING} !(returnurl|[&]returnurl)=(http|https)://([a-zA-Z0-9]+[.]example[.]com|[a-zA-Z0-9]+[.]exampledev[.]com|example[.]com|exampledev[.]com)[&]{0,1}
    RewriteRule ^(.*) / [R=403,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a simple WebServer using HttpListener class (.net 2.0) It seems that It
OS: ubuntu 11.10 Webserver: Apache Code: PHP I am trying to display the output
OS: ubuntu 11.10 Webserver: Apache Code: PHP Hello I am trying to exec a
Im running a Apache Webserver under Windows Sever 2003. I noticed that my logfile
I have a webserver setup using the standard linux, apache, mysql, php config and
I have an apache webserver that is used to serve php and static web
I have webserver using default virtualhost apache <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory
My webserver is hosting many apps whose path looks like http://example.com/app1/ http://example.com/app2/ ... I
I have an apache webserver serving 2 URLs. I use VirtualHosts to configure it
I have this webserver that have an IP address xxx.xxx.xx.x, I also have a

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.