CodeIgniter Forums

Full Version: Moving everything from root to a subfolder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am about to install a small (but very useful) "Coming Soon" set of pages available here https://prelauncher.net which, as far as I could understand after downloading it, has been created using CodeIgniter. If I manage to let it work as expected, such tool will be useful to gather some contacts before I open my small website.
All the system comes inside a /prelauncher/ folder, which is nice and tidy.
Now: if I take all the files and folders that I find in there, place them at root level, and type say https://example.com it all works fine.
If instead (as I would prefer to) I keep all the package inside its own /prelauncher/ folder and type something like https://example.com/prelauncher/ then the system does not seem to work as it should.
Where is the trick, please?
I read the manual, but it is far from clear (unless you already know how such things should work) and real examples are not available. 

In short: if the whole thing works when all files are placed at root level, what and how should be changed in order to let it run when all the files are placed inside a /subfolder/ please?

Thanks!
edit config.php

$config['base_url'] = 'https://example.com/prelauncer/';
@kirpi

See this project: https://github.com/ivantcholakov/codeign...erver-test

If you download it and place it within a sub-folder it will just work. There is custom URL-autodetection included, examine the sources.
(07-11-2017, 04:16 PM)my_RZ Wrote: [ -> ]edit config.php

$config['base_url'] = 'https://example.com/prelauncer/';

I went to application/config/config.php and changed this line:

Code:
$config['base_url']  = get_domain();
into

Code:
$config['base_url']  = "https://example.com/prelauncher/";
[I mean, the real domain] yet nothing seems to change, even when trying on different browsers and cleaning the cache.

Also, I noticed that, along with other folders and files inside /prelauncher/ (application, assets, database, system, uploads, index.php,...)
there is a .htaccess file.
There, I tried and change this:

Code:
 ...
  # If your page resides at
  #  http://www.example.com/mypage/test1
  # then use
  # RewriteBase /mypage/test1/
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
 ...
into this:

Code:
 ...
  # If your page resides at
  #  http://www.example.com/mypage/test1
  # then use
  # RewriteBase /mypage/test1/
  RewriteBase /prelauncher/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
 ...
but again nothing changes...

It seems that I am stucked.

Now I will try ivantcholakov's suggestion, although I definitely believe there the solution should be the first one...
Where am I wrong, please?
(07-12-2017, 06:30 AM)kirpi Wrote: [ -> ]
(07-11-2017, 04:16 PM)my_RZ Wrote: [ -> ]edit config.php

$config['base_url'] = 'https://example.com/prelauncer/';

I went to application/config/config.php and changed this line:

Code:
$config['base_url']  = get_domain();
into

Code:
$config['base_url']  = "https://example.com/prelauncher/";
[I mean, the real domain] yet nothing seems to change, even when trying on different browsers and cleaning the cache.

Also, I noticed that, along with other folders and files inside /prelauncher/ (application, assets, database, system, uploads, index.php,...)
there is a .htaccess file.
There, I tried and change this:

Code:
 ...
  # If your page resides at
  #  http://www.example.com/mypage/test1
  # then use
  # RewriteBase /mypage/test1/
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
 ...
into this:

Code:
 ...
  # If your page resides at
  #  http://www.example.com/mypage/test1
  # then use
  # RewriteBase /mypage/test1/
  RewriteBase /prelauncher/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
 ...
but again nothing changes...

It seems that I am stucked.

Now I will try ivantcholakov's suggestion, although I definitely believe there the solution should be the first one...
Where am I wrong, please?


remove trailing slash
in your .htaccess
RewriteBase /prelauncher
Also

Code:
RewriteBase /prelauncher
does not work.

Most probably this CodeIgniter thing is something useful but way too difficult and technical for me.

I will stay content in taking all the files out of their /prelauncher/ folder and placing them at root level.

Thank you all the same :-)
If the ./application and ./system folders are moved to the root
and index.php is in say public then you need to edit the index.php
file and point the ./application and ./system folders to the correct
folders.

usually ../application and ../system
(07-11-2017, 02:58 PM)kirpi Wrote: [ -> ]I am about to install a small (but very useful) "Coming Soon" set of pages available here https://prelauncher.net which, as far as I could understand after downloading it, has been created using CodeIgniter. If I manage to let it work as expected, such tool will be useful to gather some contacts before I open my small website.
All the system comes inside a /prelauncher/ folder, which is nice and tidy.
Now: if I take all the files and folders that I find in there, place them at root level, and type say https://example.com it all works fine.
If instead (as I would prefer to) I keep all the package inside its own /prelauncher/ folder and type something like https://example.com/prelauncher/ then the system does not seem to work as it should.
Where is the trick, please?
I read the manual, but it is far from clear (unless you already know how such things should work) and real examples are not available. 

In short: if the whole thing works when all files are placed at root level, what and how should be changed in order to let it run when all the files are placed inside a /subfolder/ please?

Thanks!

I DLed the package from your linked site (nice - might use it myself).  It is a "prepackaged" CI application I guess meant to be run from the domain root (http://mysite.com).  It contains all the CI application and system files for a standalone app.  

You can use this and add your own app files or extract the prelauncher specific files (the Application folder) and merge it into your existing project.  I would suggest running the prelauncher at the root of your domain and develop your application as a subdomain (http://mysite.com/dev).  When ready, blow away the prelauncher, migrate release code to the root, tweak configs. 

Just my $.02 - good luck and don't give up the ship

Regards,
--Wolf--