Subdirectories

From phpCMS

Jump to: navigation, search

Contents

[edit] Subdirectories: Installing phpcms deeper than "/"

Version: phpcms 1.2.1 --Iok 17:12, 9 Jan 2006 (CET)

I hope the following is correct and helpful. If not, please correct me.

[edit] Nutshell

To make a mint installation run in a subdir, e.g., /new/demo-en/, change these files:

  1. .htaccess (adjust path to parser.php)
  2. .ini files (adjust HOME and PLUGINDIR)
  3. parser/include/default.php (adjust MAIL2CRYPT)

Verified for: stealth-mode installation on Apache server

[edit] Long version

The documentation and several forum threads advocate to install phpcms directly below DOCUMENT_ROOT, e.g. to use /parser/ (for the system) and something like /demo-en/ (for the content and templates).

What if you must install a system in a subdirectory? This can be necessary to

  • accomodate multiple websites living on just one virtual host,
  • hide a "work in progress" installation on a host that also contains a live version

The following steps work well for me. They assume a "stealth mode" setup (using mod_rewrite) with content editing enabled:

  1. Install a fresh tarball (zipfile) of phpcms to the target directory. I will assume "(DOCUMENT_ROOT)/new/" as your target. So, the path to the parser will be "/new/parser/parser.php". Get the rights right: If possible, set ownership/group to "wwwrun" (or "www-data", or whatever user your webserver runs as). Make files "644" (write owner, read all) and directories "755" (write/exec owner, read/exec all).
  2. Setup your .htaccess. The sample.htaccess contains the following block for mod_rewrite:
    RewriteEngine on
    RewriteBase /
    RewriteRule (.*)\.htm$ /parser/parser.php?file=/$1.htm [PT,QSA]
    Adjust the path to the parser and the file argument so it points to your document directory. The following example assumes that you put your .htaccess in the document directory (demo-en). Also, it specifies a RewriteCondition that catches URL arguments like ?phpcmsaction=edit (you add this chunk to a page URL in the browser to be able to edit the page).

    #Cond/Rule for URL args
    RewriteCond %{QUERY_STRING} ^(..*)
    RewriteRule (.*)\.htm$ /new/parser/parser.php?file=/new/demo-en/$1.htm&%1 [L]
    #Default Rule
    RewriteRule (.*)\.htm$ /new/parser/parser.php?file=/new/demo-en/$1.htm [L]

  3. Adjust the absolute path names in the project files (the .ini ones). They're under ./demo-en/template/. Start with "home.en.ini". The HOME and PLUGINDIR paths need to be set correctly (prepend /new). In the other default .ini files, the PLUGINDIR path is missing; make it the same as in home.en.ini.
  4. Do your usual adjustments in ./parser/include/default.php: I.e., set stealth mode and secure stealth mode to "On", allow editing, change the default password. Personally, I don't trust the "configure" option of the GUI, I prefer to change these spots manually in the file default.php. I recommend you do the same .-)
  5. Adjust the absolute path to MAIL2CRYPT in the default.php (i.e., change "/" to "/new").


That's it. The parser GUI should work now (try yourhost/new/parser/parser.php: is there a frameset and a login prompt?) and the demo website should be accessible (via yourhost/new/demo-en/index.htm). The "site search" and "sitemap" functions of the demo website should work. Try edit mode (yourhost/new/demo-en/index.htm?phpcmsaction=edit). It should prompt you for your password and let you edit the page content.

Note that the GUI link "Demo Website" will not work until you set the paths of the GUI right (I didn't bother yet).

[edit] Links

Much of this has been discussed on the old forum. Some of the threads are:

Main Page: Tutorials MainPage | Top Page: MiniHowTos MainPage

Personal tools