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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:42:58+00:00 2026-05-15T23:42:58+00:00

I have a codeigniter multistie install where I have such code that I can

  • 0

I have a codeigniter multistie install where I have such code that I can serve sites with such links

site.com/sites/sitename/controller/function/vars
site.com/controller/function/vars/

subdom.site.com/controller/function/vars

the challange is that , whith the routing

$route['sites/([^/]+)/(.*)'] = '$2';
$route['default_controller'] = "content";

I get working the links like

site.com/sites/sitename/controller/function/vars
site.com/controller/function/vars

By idea when I go to

http://www.site.com/sites/sitename/

the default controller is not loading.

I made the config.php so that regarding the link structure, when I visit link

site.com/sites/sitename/controller/function/vars

then

$config['base_url']="http://site.com/sites/sitename";

if I go to

site.com/controller/function/vars

then

$config[‘base_url’]=”http://site.com/”;

for the second case the default controller loads perfectly. For the subsite case not/

I get just 404

What to do?

UPDATE 2:

I have a multifolder setup.

When user goes to http://www.site.com/sites/site_name

then a folder of application

/root_folder/usersites/site_name is loaded.

When user goes just site.com/controller/function/var1/var2

a default application folder which is

/root_folder/application is loaded

when user goes to sub1.site.com application folder

/root_folder/domains/sub1_site_com is loaded

So when I enter in address bar

http://site.com/sites/site_name

it should be like no URI. and should load default controller.

    // Application folder loading code
$myApp = '';


if($_SERVER['SERVER_ADDR']=='127.0.0.1'){
    $main_url='site.com';
}
else{
    $main_url='site1.com';
}

//echo $main_url;

switch($_SERVER['HTTP_HOST'])
{
    case $main_url;




        $uri_string=$_SERVER['REQUEST_URI'];
                    $link_way=explode('/',$uri_string);

        if(strlen($uri_string)>6 and $link_way[1]=='sites' ){



            //print_r($link_way);
            //var_dump($link_way);

            //checking if the link goes to usersites and sitename is bigger and =5
            if($link_way[1]=='sites' and strlen($link_way[2])>=5){


                $myApp='sites/usersites/'.$link_way[2];
                define('SITE_ALIAS','1|'.$link_way[2]);


                }
            elseif($link_way[1]=='sites' and strlen($link_way[2])<5){
                exit('Username should be more than 4 chars');

                }






            }

        else{

                        define('SITE_ALIAS','0|'.str_replace('.','_',$_SERVER['HTTP_HOST']));


        $myApp = 'application';
                }




        break;

     default:
        $myApp = str_replace('.','_',$_SERVER['HTTP_HOST']);
        $myApp=str_replace('www_','',$myApp);
                 define('SITE_ALIAS','2|'.$myApp);
        $myApp='sites/domains/'.$myApp;



    }

$application_folder = $myApp;
  • 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-15T23:42:58+00:00Added an answer on May 15, 2026 at 11:42 pm
    $uri_string=$_SERVER['REQUEST_URI'];
                        $way=explode('/',$uri_string);
    
    
                           /// print_r($way);
    
    //echo $way[3];
                            if($way[1]=="sites" and strlen($way[2])>2 and strlen($way[3])<1){
    
    
                                echo "JAJA ";
    
    
    $route['sites/:any'] = "content/show_page/home";
                            }
                            else{
    
    
    
                               $route['sites/([^/]+)/(.*)'] = '$2';
                            }
    

    this was solution. thanks all who answered. thanks stormdrain. you pointed me to a write direction in your routing example. Thanks

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

Sidebar

Related Questions

Basically, I have a CodeIgniter site that registers users through this url: http://website.com/user/register/1 Unfortunately,
I have a codeigniter code that is working on local Apache installation. But it
I have a CodeIgniter site and the problem is I have: RewriteCond %{HTTP_HOST} ^example\.com
I have a site using CodeIgniter that is almost complete now. My problem is
I'd like to have my codeigniter site to accept URLs like the following:- www.domain.com/?gclid=CM5D19f6OlKoC7RRc8QodUn6Pxw
I have a codeigniter application.In that i call the controller function using ajax/jquery.But when
I have CodeIgniter question. How can I pass an array from controller to view?
I have enabled Codeigniter's CSRF protection on my site that uses AJAX to submit
I have 2 CodeIgniter installations, 1 on mydomain.com another on sub.mydomain.com. I am trying
Does Codeigniter 2 have a cleaner way of doing what's shown in the code,

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.