Welcome Guest, Not a member yet? Register   Sign In
single system tolder, no index.php, sub-folders in controllers... oh the mess!
#1

[eluser]jblack199[/eluser]
So I'm trying something new (to me) with this new application I am building. And that is to use one system folder for all projects on a particular domain... but also with removing index.php from the url... so, this is what i've got...

here is my current file structure..

|-documentroot-|
--| index.php |
--| inc |
---| css |
---| images |
---| js |

--| system |

--| tfamastery |
---| application | (i have the entire application folder here..)
----| controllers |
-----| admin |
------| main.php |
----|main.php|
---| index.php |

so that's my current file structure of it..

So I always autoload my session library and the url helper so I have those in auto load.

in my config.php, i set my base_url as:

http://www.insurancemavs.com/tfamastery/
and set my $config['index_page'] = '';

inside the tfamastery folder I have a .htaccess file with the following:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} !^www\.insurancemavs\.com
    RewriteRule .* http://www.%{SERVER_NAME}%{REQUEST_URI} [R,L]
    
    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ index.php/$1 [L]
    
    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ index.php/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

I know it's running and working as when i go to the main domain it does infact redirect me to the www version of the page if i didn't go there with www anyway...

in my index.php i did have to change the system folder path, and for that I used the full linux path of it...

$system_path = '/home/account_user/html/insurancemavs.com/system';

the main.php listed in the admin subfolder in the controllers is a direct copy of the main.php in the controllers root...

in routes.php i've changed my default controller to be main and i know that's working....

so, when i go to:

http://www.insurancemavs.com/tfamastery i get the page I'm looking for..

if i go to:
http://www.insurancemavs.com/tfamastery/admin/ i get a 404 error...

but, if i go to:
http://www.insurancemavs.com/tfamastery/...php/admin/

i get the page I am looking for... any ideas?

EDIT:

was my .htaccess... I used the same one I have for the root of my general purpose CI configuration.... so I had to add the tfamastery folder to the RewriteBase...




Theme © iAndrew 2016 - Forum software by © MyBB