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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:13:04+00:00 2026-05-18T20:13:04+00:00

I have a website let’s say www.example.com and I have a subdomain something.example.com Both

  • 0

I have a website let’s say www.example.com and I have a subdomain something.example.com

Both main domain and sub domain are pointing to directory “public_html”

I have .htaccess on root which redirects any URL without www to www.
For e.g. if user enters example.com then he will be redirected to http://www.example.com
If user enters example.com/mypage.html then he will be redirected to www.example.com/mypage.html

Now the problem is this is also affecting my subdomain. Because if someone enters something.example.com/visit.html then he is redirect to www.example.com/visit.html

I don’t want this! If user enters subdomain then I don’t want to redirected to www domain. This is what I have in my .htacces file

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

Can you please tell me what should I do to solve above problem?

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-18T20:13:05+00:00Added an answer on May 18, 2026 at 8:13 pm

    Do you have access to your webserver configuration? This is better done by configuring the webserver.

    On apache you would configure one virtual domain like this:

    <VirtualHost *:80>

            ServerName somedomainiwanttoredirect.com
            ServerAlias maybe.somemoredomainstoredirect.com
            ServerAlias orsubdomains.toredirect.com
            RewriteEngine On
            RewriteRule ^(.*)$ http://www.target.com/$1 [R=301,L]

    </VirtualHost>

    and on your real configuration, the http://www.target.com you add your subdomains that you do not want to be redirected:

    ServerAlias subdomain.target.com

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

Sidebar

Related Questions

Let's say I have a website with domain: www.example.com If I set a cookie
Here's a possible scenario. Let's say I have a website https://www.mywebsite.com and there is
I have two websites, let's say they're example.com and anotherexample.net . On anotherexample.net/page.html ,
Let say that I have a website with some information that could be access
Let's say that I have a Flash website where you could create an avatar
Let's say that I have a website where I'd like users to be able
Title might be a bit confusing, so let me explain. I have a website
We let users create ad-hoc queries in our website. We would like to have
Let's say I have a web site for hosting community generated content that targets
I have an auction website which let my users place an unlimited amount of

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.