My previous folder tree was (with portable xampp): (for example working on D: drive root)

/xampp/htdocs/application
/xampp/htdocs/system
/xampp/htdocs/themes
/xampp/htdocs/index.php etc..

Now I am trying to shift into a structure which I can work with multiple projects so new tree:

/xampp/htdocs
/web_projects/project-name/codeigniter/application
/web_projects/project-name/codeigniter/system
/web_projects/project-name/htdocs/themes
/web_projects/project-name/htdocs/index.php

My htaccess file in htdocs:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)

# if Serves works on Linux OS
RewriteRule ^(.*)$ index.php/$1

# if Server works on Windows OS
# RewriteRule ^(.*)$ index.php?/$1

RewriteCond %{REQUEST_FILENAME} !-f

# if Serves works on Linux OS
RewriteRule ^(application|modules|plugins|system|themes|library|files) index.php/$1 [L]

# if Server works on Windows OS
# RewriteRule ^(application|modules|plugins|system|themes|library|files) index.php?/$1 [L]

And httpd-vhosts.conf:

NameVirtualHost *:8080

<VirtualHost *:8080>
    DocumentRoot "/xampp/htdocs"
    ServerName localhost
    <Directory "/xampp/htdocs">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:8080>
    DocumentRoot "/web_projects"
    ServerName welcome.localhost
    <Directory "/web_projects">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:8080>
    DocumentRoot "/web_projects/test/htdocs"
    ServerName test.localhost
    <Directory "/web_projects/test/htdocs">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Finally etc/host:

127.0.0.1 localhost
127.0.0.1 welcome.localhost
127.0.0.1 test.localhost
127.0.0.1 vstart # Alias for test

All virtual hosts are working, i.e. http://vstart:8080/ is working but codeigniter not operates without index.php in address line, so routes are not working in accordance.

My config/config.php file is:

$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

$config['index_page'] = '';

This set was working smoothly in my previous folder tree now is not working. I digged internet to find a solution with failure.

Any outer eyes to catch where I am doing wrong?

Recommended Answers

All 2 Replies

You can handle multiple applications but you have to change the structure, this it may help: http://codeigniter.com/user_guide/general/managing_apps.html

Note: Each of your applications will need its own index.php file which calls the desired application. The index.php file can be named anything you want.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.