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 6599141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:27:06+00:00 2026-05-25T18:27:06+00:00

I have a server that I am setting up to rewrite subdomains as get

  • 0

I have a server that I am setting up to rewrite subdomains as get parameters

So,
subdomain.example.com/blog/test
would actually point to:
example.com/index.php?website=subdomain&request=blog/test

I have setup the domain with an A record with a value of *, and I have setup the server to ALIAS *.example.com to example.com. All of that is working.

In my .htaccess I have

RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteCond %{HTTP_HOST} ^([^/\.]+).example.com(.*)$ [NC]
RewriteRule ^(.*)$ index.php?website=%1&request=%2 [L]

Here is a var_dump() of $_GET when i go to subdomain.example.com/blog/test

array(2) { ["website"]=> string(8) "subdomain" ["request"]=> string(0) "" } 

the subdomain is coming in perfectly in the website parameter, but the rest of the request is not there in the request parameter. Any Ideas? I really appreciate the help. Thanks in advance.

By the way if I use

RewriteRule ^(.*)$ index.php?website=%1&request=$1 [L]

Then I get index.php in the request parameter. If that tells you something additional.

AMENDMENT

Per John’s suggestion I tried the following

RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteCond %{HTTP_HOST} ^([^/\.]+).wescms.com(.*) [NC]
RewriteRule ^(.*)$ index.php?website=%1&request=%{REQUEST_URI} [NC,L]

If you go to subdomain.example.com/blog/test the REQUEST_URI comes back with index.php
I did a var_dump() of the $_SERVER variable, and in the REQUEST_URI it shows /blog/test, but its not making it through the RewriteRule.

If I use THE_REQUEST in the rewrite rule rather than REQUEST_URI, I get back what I need plus some extra bits but I would appreciate understanding more about why REQUEST_URI is not working as in my last example. Thanks.

  • 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-05-25T18:27:07+00:00Added an answer on May 25, 2026 at 6:27 pm

    Your second RewriteCond is matching against %{HTTP_HOST}, which only includes the hostname the of the request, not the “path” portion.

    The requested resource (basically, the part of the URL after the hostname) is available as the %{REQUEST_URI} variable. In your situation, you could use the variable directly in your rule rather than trying to capture that data in a RewriteCond.

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

Sidebar

Related Questions

I have a site that needs to use mod_rewrite to direct traffic to www.example.com
I have the following page: www.domain.com/index.php?route=information/contact and I'd like to rewrite it so that
I have a system sitting on a Master Server, that is periodically transferring quite
I have a server that is running Ubuntu Linux Server Edition. I once had
I have a server that has several virtual machines running on it. I'm trying
I have a server that connects to multiple clients using TCP/IP connections, using C
I have a server that I have no control over, it's JSON based and
I have a server that communicates to a lot of devices (>1000). Each connection
I have a server that receives various xml messages from clients (one thread per
Alright, I have a server that serves a motion-jpeg stream over http. What I

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.