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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:39:53+00:00 2026-06-03T08:39:53+00:00

I have a mod rewrite that currently redirects domain.com/folder/user to domain.com/folder.php?username=user using: RewriteRule ^folder/(.+)$

  • 0

I have a mod rewrite that currently redirects

domain.com/folder/user

to

domain.com/folder.php?username=user

using:

RewriteRule ^folder/(.+)$ folder.php?username=$1 [QSA,L]

What I need done however is redirect http://user.domain.com/ to http://www.domain.com/folder.php?username=user . And if possible, I could exclude certain subdomains (like www. mail., etc. from being forwarded).

How would I do this? Any help is GREATLY appreciated 🙂

  • 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-03T08:39:55+00:00Added an answer on June 3, 2026 at 8:39 am

    How it works:

    • Extract user from http://user.domain.com/ and save a backreference to it with a RewriteCondition.
    • The hostname of the request is stored in a Server-Variable.

      enter image description here
      Figure : The back-reference flow through a rule.
      In this example, a request for /test/1234 would be transformed into /admin.foo?page=test&id=1234&host=admin.example.com. Source

    • In the RewriteRule use the RewriteCondition‘s backreference.

    • See also the note in the RewriteRule section:

      If you wish to match against the hostname, port, or query string, use a RewriteCond with the %{HTTP_HOST}, %{SERVER_PORT}, or %{QUERY_STRING} variables respectively.

    • Configure your (virtual) server to listen to all the domains you want to-rewrite within to ensure all requests are passed into the same section/root of your server where you can do the rewrite. Otherwise you need to proxy internally.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a really simple mod-rewrite rule : RewriteRule ^(.*)$ index.php?url=$1 [PT,L] As an
I have a site that currently serves results as example.com/index.php?show=foo and I'd like it
I currently have the working Mod Rewrite Regex: RewriteEngine On RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule
Quick one. I'm using mod rewrite and have most replacements in place: empty space
Currently I have a url like this http://<client_name>.website.com/index.php?function_name&cat=32 I want to set things up
I have a project that lives at the following domain: http://www.example.com/PROJECT/ within project, there
I have a (Joomla) site that is not currently pointing to a domain, but
I have two domains that are aliases, domain1.com and domain2.com Currently they are both
I'm using mod rewrite to access my PHP files in the root directory of
In my site, I have used mod rewrite to make search engine and user

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.