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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:45:57+00:00 2026-06-01T12:45:57+00:00

I think what I’m trying to do is more complex than I originally thought.

  • 0

I think what I’m trying to do is more complex than I originally thought. The first part is straight forward: I’m using .htaccess to redirect mobile browsers to the “mobile” verson of a website on a different domain. Here’s the contents of .htaccess in the root of the “non-mobile” site:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} android.+mobile|iphone [NC]
RewriteRule ^(.*)$ http://m.domain.tld%{REQUEST_URI} [R]

The second part adds some complexity. I’m using .htaccess on the mobile domain to redirect most requests to index.php in the root directory. Here’s the contents of .htaccess in the root of the mobile site:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*) index.php

When a request that’s sent to the non-mobile site contains only the domain name, this all works as expected:

http://www.domain.tld

gets redirected to

http://m.domain.tld

with no problem.

Also, If a mobile browser loads

http://m.domain.tld/abc

it works as expected: index.php in the root of the mobile domain is loaded, and it parses the request URL, and assigns the value “abc” to a variable.

However, things break down strangely when I try to navigate to

http://www.domain.tld/abc

in a mobile browser. This results in the non-mobile file,

http://www.domain.tld/abc/index.php

being loaded into the browser, formatted by CSS from the mobile domain. The initial redirect that I want to be executed is not executed, but apparently, subsequent requests, like the one for the CSS file, are being redirected. Both domains are vhosts on the same server.

Can anyone weed through what I’m trying to do and offer a solution?

Thanks,
Dave

  • 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-01T12:45:58+00:00Added an answer on June 1, 2026 at 12:45 pm

    I figured this out. The problem was that there was no .htaccess in directory /abc on http://www.domain.tld to redirect mobile browsers. I guess I was expecting Apache to magically ignore the fact that the /abc directory exists and process all requests through the .htaccess in the root directory of the vhost.

    So, the request for http://www.domain.tld/abc was not being redirected. And the “mobile formatting” was being applied because although the address bar showed “http://www…”, the request for that resource was coming from “http://m…”, and the CSS file exists on the mobile domain.

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

Sidebar

Related Questions

I think I already know the answer to this but thought I would ask
Think about a rectangular div, which is split into 2 parts, each part is
I think that I have a quite strange question. I am using a class
Think about the following: Your ISP offers you a dynamic ip-address (for example 123.123.123.123).
Think: tiling my emacs window with eshells, a la xmonad. Is this possible? I
I think I understand the basic principals of T4 but I'm having a hard
I think I divide it because css grew big, and to do import. @import
I think know how to do this in C# but I'm having syntax trouble
I think I'm burnt out, and that's why I can't see an obvious mistake.
I think I saw someday a way to create a link without sending the

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.