I want to serve my main domain from a sub-directory in the doc_root in a shared Apache/PHP server. The application is developed using Codeigniter and all the urls are dynamically created using base_url() function. The problem is, all the urls have the name of the subdirectory as well. I want to remove it but don't know how to do it.
base_url produces urls like http://example.com/v2/public_html/page1
.
but I want it to produce http://example.com/page1
.
Both the above urls serve the correct page however.
This is my directory structure:
|-doc_root
|-v1
|-v2
|-system
|-application
|-public_html
|-.htaccess
|-.htaccess
|.htaccess
In my config.php file I have setup $config['base_url'] = "http://example.com/";
.htaccess file in doc_root:
RewriteEngine on
RewriteRule ^$ v2/public_html/ [L]
RewriteRule (.*) v2/public_html/$1 [L]
.htaccess in doc_root/v2:
RewriteEngine on
RewriteRule ^$ public_html/ [L]
RewriteRule (.*) public_html/$1 [L]
And the .htaccess in doc_root/v2/public_html:
RewriteEngine on
RewriteBase /v2/public_html
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Please help me to get this resolved.