codeigniter - Default Controller not loading after rerouting -


I have a codeigniter multistie installed where I have code that I can serve sites with such links < / P>

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

subdom.site.com/controller/function/vars

The challenge is that, in routing

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

I am working like a link

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

When I go to

www.site.com/sites/sitename/

, the default controller is not loading.

I created Config.php so that the link structure is related to when I

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

link Go

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

If I go to

site.com/controller/function/vars

$ Config ['Base_url'] = "http://site.com/";

The default controller for the second case is fully loaded for the subtitle case /

I just get 404

What to do?

2 Update:

I have a multi purpose setup.

When a user goes to www.site.com/sites/site_name

then a folder of the application

/ root_folder / usersites / site_name is loaded .

When the user only goes to the site.com/controller/function/var1/var2

a default application folder

/ root_folder / app is loaded < /

/ root_folder / domains / sub1_site_com is full

so when I enter in the address bar

>

It should be like a URI And should load the default controller

  // app folder loading code $ myApp = ''; If ($ _ server ['SERVER_ADDR'] == '127.0.0.1') {$ main_url = 'site.com'; } And {$ main_url = 'site1.com'; } // echo $ main_url; Switch ($ _ server ['HTTP_HOST']) {case $ main_url; $ URI_string = $ _ server ['REQUEST_URI']; $ Link_way = explosion ('/', $ uri_string); If (strollen ($ uri_string)> 6 and $ link_way [1] == 'site') {// print_r ($ link_way); // var_dump ($ link_way); // Check that the link goes to users and the sitename is bigger and = 5 if ($ link_way [1] == 'sites' and strollon ($ link_way [2]) = 5) {$ myApp =' sites / usersites /'.$link_way[2]; Define (. 'SITE_ALIAS' '1 |' $ link_way [2]); } Otherwise ($ link_way [1] == 'Site' and Stellen ($ link_way [2]) & lt; 5) {exit ('Username should be more than 4 characters'); }} And {define ('SITE_ALIAS', '0 |' .str_replace ('.', '_', $ _ Server ['HTTP_HOST'])); $ MyApp = 'Application'; }             break; Default: $ myApp = str_replace ('.', '_', $ _ Server ['HTTP_HOST']); $ MyApp = str_replace ('www _', '', $ MyApp); ('SITE_ALIAS' '2 |' $ MyApp.); $ MyApp = 'sites / domain' '. MyApp; } $ Application_folder = $ myApp;  

What you see is seeing a controller with 'sitename' So if you go to site.com/sites/my-site/ you can say that a controller is given the name of my site and the index method should be run. .

There should be a path to the actual controller / method pair of the value path.

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

should be $ route [sites /([^/]+)/(.*) '] =' site / index / $ 1 / $ 2 ';

Believes it is the indexing method that accepts sitename because it is the first parameter in your site controller.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -