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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:18:15+00:00 2026-05-22T12:18:15+00:00

I have never before rewritten a URL except for removing the index.php part of

  • 0

I have never before rewritten a URL except for removing the index.php part of my CodeIgniter installs, and that I do by using a copy-pasted snippet in my .htaccess file. I haven’t had the time to actually learn about what the snippet does; I’m basically very new to rewriting URLs.

I have a mobile version of my web application. I got as far as redirecting mobile users to a subdomain: m.myhost.tld. However, since I’m using (one) CodeIgniter (install), I have to send these mobile users to a mobile-specific controller, in my case /mobile/. So, the controller always shows up in my address bar.

I just don’t think this is very clean, and I’m looking for a way to rewrite the URL; but truth be told, I’m not even sure if this is possible.. hence my question.
I want to get rid of the /mobile controller part. Is this possible?

Some examples:

My current mobile ‘root’ folder is

http://m.myhost.tld/mobile

I would like to turn this one into

http://m.myhost.tld/

At the moment, when I go to http://m.myhost.tld/, it redirects to the default controller for my CodeIgniter application, which is part of the ‘desktop’ version of the web app.

Another example:

Turning

http://m.myhost.tld/mobile#mobile/about

into

http://m.myhost.tld/#mobile/about

I’m not sure if I’m making any sense here. I am in my head, but like I said, I don’t know what exactly is possible. If the user is on the m subdomain, I want to hide the /mobile part of my URLs. However, only when we’re on the m subdomain, so the ‘desktop’ version (which sits at www ) does not get touched at all.

Like I said a couple of times now, I’m not sure what is possible and what I’m looking for might just be too complex or whatnot. I figured I would ask though, since learning by asking is what I do best. Please don’t be too hard on me if this turns out to be a dumb question, sirs professionals 😉

EDIT:
I thought I’d edit because I don’t want to come off wrong. I’m not necessarily looking for exact answers to my question. I also welcome documentation/tutorials/articles that might guide me to a solution. If I can manage to come up with a solution of my own, I will of course learn a lot more.

Thanks a lot.

  • 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-22T12:18:15+00:00Added an answer on May 22, 2026 at 12:18 pm

    This could be too simple of a solution but why not in your routing config do something simple like

    in your config do something like

    if ($_SERVER['SERVER_NAME'] == 'm.myhost.tld')
        $route['default_controller'] = "mobile";
    

    This would make the default controller mobil so you wouldn’t have to have /mobile…

    As i said maybe too simple

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

Sidebar

Related Questions

Just another of those things that I have never done before but which is
I have never used Prototype before. But now when I'm using Rails, it seems
Before you answer this I have never developed anything popular enough to attain high
I'm designing a game server and I have never done anything like this before.
I have seen this macro defined before but never really knew its purpose. Can
I've never developed Flash before but I have a project where I want to
I am having a really unsual problem I have never had before, I have
I've written several Web MVC apps but never before in PHP, and I'm trying
i have an really unusual problem i've never had before. i've no .htaccess file
I'm trying to write a jQuery script (I have never written one before and

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.