php - CodeIgniter controllers unreachable -


i developed web application using xampp , codeigniter. best way handle clean routing has been set virtualhost point on folder containing project in xampp/apache/conf/httpd.conf, using routing routes in route.php file, e.g.,

$route['page1'] = "page1controller/page1function"; 

i use href or header using root base folder:

href="/page1" 

all works on locally , never use base_url() or such functions.

switching production server, don't have rights except personal folder , subfolders when execute it, root folder becomes root of domain, not project folder.

i tried base_url() doesn't work, pages aren't found, when not using $route.

is there way handle without refactoring links in code or way refactoring?

edit

instead of using "/page1", i'm using "./page1" access location of index.php folder. however, i'm still not able access other pages neither php, nor html/js.

assuming routing working on local, here steps took adapt production server.

1 - first letter capital on controllers , views

codeigniter requesting use of capital letters in naming of controllers , views if routing working on windows, linux case-sensitivity requires right naming in both class title , reference in routes.php file.

2 - using './' instead of '/'

because deployment of application occurs in subdomain, root corresponds domain rather subdomain index.php resides , accessible './' (cf. question).

3 - hardcoding subdomain path in .htaccess file

following doc, executed steps correct standard .htaccess file make work sub-directory on server. standard variant remove '/' rule :

rewriterule ^(.*)$ /index.php/$1 [l] 

which leads

rewriterule ^(.*)$ index.php/$1 [l] 

however, hasn't solve on server, had hardcode path :

if running ee sub-directory , still doesn’t work after removing slash, may need specify sub-directory in rewrite rule. example, if sub-folder named testing, change:

rewriterule (.*?)index\.php/*(.*) /$1$2 [r=301,ne,l]

to:

rewriterule (.*?)index\.php/*(.*) testing/$1$2 [r=301,ne,l]

and change:

rewriterule ^(.*)$ /index.php/$1 [l]

to:

rewriterule ^(.*)$ testing/index.php/$1 [l]


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -