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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:25:55+00:00 2026-06-16T18:25:55+00:00

I want a user who made request from example.com to mydomain.example/domains to redirect to

  • 0

I want a user who made request from example.com to mydomain.example/domains to redirect to mydomain.example/userdomain. It is like implementing vanity URLs as per the user’s domain name.
I know, we can do it using .htaccess redirect rules but don’t know how to do.

  • 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-16T18:25:56+00:00Added an answer on June 16, 2026 at 6:25 pm

    I’ve EDITED the following code as best I can without a way to test it. It should get you close if it doesn’t work.

    RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
    RewriteRule ^/(.*) http://%1/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^(.*)$ [NC]
    RewriteRule ^/(.*) mydomain.example/%1/$1 [L]
    

    should do the trick. Can’t test it quickly myself though. There are two key things to notice:
    You gotta use HTTP_HOST in a RewriteCond to test the domain. Use %1 in the RewriteRule line to get the variable from the HTTP_HOST line in parentheses.

    You also gotta redirect any requests to www to the non www with an R=301 permanent redirect first. It might be possible NOT to do this, but I’m not sure at the moment how to extract the non www part of the host regardless of its presence. The R=301 sends a redirect msg back to the browser for anyone who visits www.example.com. Then the browser will hit example.com and your second RewriteRule will match against it. Since its 301 (permanent) the browser will cache the redirect and always do the non-www for the user on its own.

    If this doesn’t work, compare to some other tutorials on URL redirection and also refer to this wonderful page:
    http://httpd.apache.org/docs/2.2/rewrite/intro.html

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

Sidebar

Related Questions

Having trouble with a mysql grant statement. I want a user who has: readonly
i want to get the user who login now .. how to do this
I have asp:DropDownList control which i want to display data to user who don't
In my application, i want user to select a font, from a list of
I have a model called Person. I want User to inherit from Person. class
I am trying to send inventory updates to users who have made a request
There is a web site http://www.pringit.com i want to receive text messages from mobile
I'm trying to learn Django and I would like feedback from anyone who has
Say you've got a user who made a few commits and rolled them into
if(callingflag) { int calledUserTp = totalPointsByUserid(callinguserid,jokercard); System.out.println(Total Points of the User Who has made

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.