CodeIgniter resides in subfolder |
[eluser]Unknown[/eluser]
Dear CI Community, I recently stumbled over this issue for a certain project: I simply want to put the CI files in a subfolder let's say /t_dynamic/ which is accessible via web by the uri /www.testsite.com/test/... Following Threads refer to this topic more or less "Subdirectory Installation" "Setting default_controller when app is not at root of domain points to: "Default Controller Bug" Also it relates somehow to the already closed (thanks Derek Jones ;-) ) bug [url="http://codeigniter.com/bug_tracker/bug/3191/]"CI Fails when bootstrap is not in Web Root in some Setups[/url] I would throw in another solution which works for me (experimental state, not fully tested yet): Since I'm just scratching the Surface of CI, I know this is not a clean and sufficient solution, but maybe there is a more elegant solution already posted somewhere else. Feedback/Discussion appreciated 1. Precondition: The files of CI resides in the subdir t_dynamic 2. .htaccess: RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteCond %{REQUEST_URI} !^/t_dynamic/ RewriteRule ^test/(.*)$ /t_dynamic/index.php/urinode/handler/$1 [NC,L] 3. system/application/config/config.php: added following line Code: $config[’uri_offset’] = “test”; 4. system/libraries/URI.php: 4.1 added methode to class CI_URI: Code: function _eliminate_urioffset() 4.2 modified methode _fetch_uri_string(): after each assignment of Code: $this->uri_string = ... Code: $this->_eliminate_urioffset(); SurnameJohn
[eluser]Michael Wales[/eluser]
So, all you are wanting is the CI framework files in subdirectory of where the rest of the application resides? Let's say a folder structure like this: Quote:- webroot All you have to do is move the index.php bootstrap file to the web_root and change the system path and app path within that file... I do this all the time - my subfolders contain nothing but the actual application files and the index.php bootstrap and the framework resides one-level up, outside of what is web accessible.
[eluser]Unknown[/eluser]
Thanks for your response Michael! Your solution looks much more simpler. But one piece distracts my goal: I want to have static html/shtml files side by side with CI while the index.html/index.shtml is served first and CI is just accessed when the subdir is given in the uri, /www.testsite.com/t_dynamic/ or more hidden via rewrite /www.testsite.com/whatever/ My initial picture in mind was the whole CI in a subfolder: Quote:/webroot So if Cis index.php is located in the webroot, the access to the static html/shtml files is not given, according to my current knowledge/testing. If I'm wrong here, Info is appreciated My first Idea for this was to write a special controller, which serves the html/shtml files in case of suffix .html or .shtml in the uri. But during coding I had the simple idea to move the whole CI in a subdir. SurnameJohn
[eluser]Rian[/eluser]
I'm having somewhat of the same problem. My CI setup is running from a subfolder in the domain and it fails to load the default controller. Gives 404: http://foo.bar.tld/sub/ http://foo.bar.tld/sub/index.php http://foo.bar.tld/sub/index.php/ works: http://foo.bar.tld/sub/index.php/ControllerName Needless to say I'd like the first 3 links to function properly as well htaccess: Code: RewriteEngine on url as defined in the config: http://foo.bar.tld/sub/ I'd prefer not to hack in the CI libs.. but then, I'd also prefer not to have to use a specific domain for the subfolder.. Any thoughts? |
Welcome Guest, Not a member yet? Register Sign In |