Running Concrete5 outside of a sub-directory install

Permalink
I have extracted Concrete5 to a sub-directory on my home server and I have been working on a php script to behave as the index.php file inside of the Concrete5 install directory, except that it isn't named "index.php", it is named "c5.php".

For the most part it works. It even installs even installs from the c5.php location. What doesn't work without any modifications to the Concrete5 install is the administration, links in search, form posts and logins. Everything works normally when accessing Concrete5 via the sub-directory that it's installed in.

<?php 
if(isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) {
  $protocol = "https";
} else {
  $protocol = "http";
}
define('BASE_URL', $protocol.'://' . $_SERVER['HTTP_HOST'].'/c5');
define('ASSETS_URL_WEB', $protocol.'://'.$_SERVER["HTTP_HOST"].'/c5');
define('DIR_BASE',$_SERVER["DOCUMENT_ROOT"].'/c5');
define('DISPATCHER_FILENAME', basename($_SERVER["SCRIPT_NAME"]));
define('REDIRECT_TO_BASE_URL', false);
#define('DIR_REL', $_SERVER["SCRIPT_NAME"]);
define('DIR_REL', '/c5.php');
define('DIR_REL_LINK', '/c5.php');
if ($_SERVER["REQUEST_URI"] != DIR_REL && $_SERVER["REQUEST_URI"] != DIR_REL."/" && file_exists(str_replace(DIR_REL,".". BASE_URL, $_SERVER["REQUEST_URI"]))) {

This code hasn't been tested on the destination server, but works on a localhost Zend Server CE install.

I know that something similar to this can be done with .htaccess settings, but the host(Yahoo) I'm working on this for doesn't have that available to me.

I have been digging through the Concrete5 code trying to fix links that do not work properly with my script, and I have found numerous instances of repeated code that could be defined by a much shorter variable.

DIR_REL . '/' . DISPATCHER_FILENAME

and
BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME

These output "/c5.php/c5.php" and "/c5/c5.php/c5.php" respectively. If those 2 parts of code were replaced with a variable defined in concrete/config/base.php my method could be implemented rather easily. I am working on it, but I can't help thinking I'm going about it the wrong way.

Has anyone done something similar and got the administration to work without vast modifications to the Concrete5 installation?

This has been my first day of working with Concrete5, and searching hadn't turned up an answer.

 
ShrineMaster replied on at Permalink Reply
I have installed this on my intended host server with an unmodified version of Concrete5 extracted into a sub-directory and my c5.php file in the root. It works the same as it did on my localhost server, the install ran successfully and shows the same output.
JohntheFish replied on at Permalink Reply
JohntheFish
Maybe attack the problem from the other end. If you need a path that swaps index.php and c5.php, you could do some mod rewrite magic in the .htaccess to get what you need.
ShrineMaster replied on at Permalink Reply
FROM:http://help.yahoo.com/l/us/yahoo/smallbusiness/glossary/glossary-08...

"Yahoo! does not currently allow you to upload .htaccess files to your account."

This isn't the ideal situation for hosting, and I'll probably move the Concrete5 install to the web root directory anyways. This was just something I saw it as a challenge that someone else might have faced.
ShrineMaster replied on at Permalink Reply
Further testing on my modified Concrete5 install shows that many features work as intended, nothing was broke. I just have to fight the OCD when something like /c5.php/c5.php/dashboard/system/ shows up in the address bar. I could eliminate that with further modification of Concrete5, but that isn't something I want to do on every release.

The default themes did appear to have missing images and menus, but that also happened on a default install, so I am not blaming my modifications.

I will continue testing and write up some documentation on my modifications, and post them here.