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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:56:16+00:00 2026-05-27T07:56:16+00:00

Say I’ve got two distinct domains: 1) http://sub.test.org 2) http://m.sub.test.org for my website. I

  • 0

Say I’ve got two distinct domains:

 1) http://sub.test.org
 2) http://m.sub.test.org

for my website.

I want domain n.1 to be associated to the full-version of my website (intended to be mainly visited by desktop user agents) and domain n.2 to be associated to its mobile-version (intended to be mainly visited by mobile user agents).

Both of the versions reside on an external host which runs an instance of Apache webserver I can’t control directly, but I am able to post .htaccess files and therefore I want them to control domain redirecting stuff (I don’t want to use Javascript neither PHP server-side logic)

The directory structure on the external host is, say:

directory / --> contains full-version website's pages and resources 
                (index.html is the entry-point)

directory /mobile --> contains full-version website's pages and resources 
                      (index.html is the entry-point)

and the mappings are:

http://sub.test.org -> /index.html
http://m.sub.test.org -> /mobile/index.html

Now, my desired scenarios are as follows:

A) When user asks for URL http://sub.test.org:

  1. IF current URL is http://m.sub.test.org/* (this means: if user is currently into the mobile-version) THEN serve page http://sub.test.org/index.html
  2. ELSE:
    1. IF user agent is mobile THEN redirect to URL http://m.sub.test.org
    2. ELSE serve page http://sub.test.org/index.html

B) When user asks for URL http://m.sub.test.org – no matter what the user agent is – user should be redirected to URL http://sub.test.org.

My questions:

  • What would be the syintax of the associated .htaccess file?
  • Do I need more than one?
  • Where should I place it/them ?

Any help/code hint would be really appreciated, because I have really a few experience with Apache .htaccess files and regexps! Thanks in advance.

  • 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-27T07:56:16+00:00Added an answer on May 27, 2026 at 7:56 am
    • http://httpd.apache.org/docs/current/howto/htaccess.html
    • You would most likely need 2
    • place one it in the root and one in /mobile
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I want to draw a Ball in the scene and here are two
Say I want to test this module: import osutils def check_ip6(xml): ib_output = osutils.call('iconfig
Say I have some pixel buffer associated with variable: CVPixelBufferRef a; I want to
Say we have two sequences and we and we want to combine them using
Say I have a Telerik MVC Grid, AJAX bound and I want to put
Say I have a class pet and it is composed of two variables: Class
Say I have two types of objects, Apples and Chainsaws . A user is
Say I have a byte array with 100,000 bytes in it. I want to
Say in my js file I want to have var NO = 0; var
Say I have two columns of names. All names in the first column are

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.