Content last modified Tuesday 24 August 2021
hop to #bottom
Categories:
Author:
About It:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

Moving the /textpattern/ folder

Ask yourself these two questions:

  • Have you ever had the urge to move the textpattern directory somewhere else and use it as a section instead?
  • Do you have a site that you want some tightened security and therefore keep the admin part of TXP on the encrypted secure https server?

Did you anser yes to any of the questions? Great, then keep on reading.

Needed note

First off, I have to warn anyone who does this that every time you update TXP you will need to do these changes on all the files.

Also, the example that follows is written about how to move the textpattern folder to a secure part of the webserver, rather than writing two examples, but hopefully you will get the idea and be able to implement it if you only wish to rename the folder to a different name.

Anything that is written in CAPS means you need to change it to the appropriate path on your webserver.

And the last thing being that this hack has only been tested on Textpattern RC3, so it might work differently in later revisions and release candidates.

The files

So let’s get started and see what files you need to keep an eye out for. The files we are going to edit are the following:

  • index.php
  • textpattern/config.php
  • textpattern/css.php
  • textpattern/publish/taghandlers.php
  • textpattern/include/txp_admin.php

Moving the files

Start off by copying everything contained in the textpattern folder from your original textpattern folder to the secure one. Also move the textpattern/css.php file to the root folder of your normal textpattern site.

Done? Well let’s get started with the editing then!

index.php

First and foremost, we start by opening up index.php and find the line that states:

include './textpattern/config.php';

Change it to read:

include '/ROOT/PATH/TO/YOUR/SECURE/WEBSITE/textpattern/config.php';

As an example, if you are on a standard Apache install this would look something like:

include '/home/henrik/www-secure/textpattern/config.php';

textpattern/config.php

This file is now located in your secure textpattern folder, so open it there and find the line:

$txpcfg['txpath'] = '/OLD/ROOT/textpattern';

Change it to read:

include '/ROOT/PATH/TO/YOUR/SECURE/WEBSITE/textpattern';

(see above for example)

textpattern/css.php

This has been moved to your root folder of your normal textpattern site, so open that one and change the line:

include 'textpattern/config.php';

to (yes, you guessed it allready):

include '/ROOT/PATH/TO/YOUR/SECURE/WEBSITE/textpattern/config.php';

textpattern/publish/taghandlers.php

This file is, of course, the one in your secure textpattern folder, and the two lines to find are the following:

if ($n) return hu.'textpattern/css.php?n='.$n; return hu.'textpattern/css.php?s='.$s;

Remove the textpattern/ text from it so they both read:

if ($n) return hu.'css.php?n='.$n; return hu.'css.php?s='.$s;

textpattern/include/txp_admin.php

Here you find the line that reads:

gTxt('log_in_at').' '.hu.'/textpattern/index.php';

and change it to:

gTxt('log_in_at').' 'https://YOURSECUREWEBSITE.COM/textpattern/index.php';

This changes the e-mail sent when you register people for using the admin interface; if you are the only user you could skip this one.

Done? Already?

Not really, we have to tidy up a bit first. Remove the textpattern folder from your normal textpattern folder and prepare yourself to do a drumroll since the excitement will be immense to see if it works, which it of course does.

So there you have it: how to move the textpattern folder to a secure folder on your webserver in some pretty simple steps.

Updating

A setback with this, of course, is that when you update you have to unpack/subvert to the non-secure folder and do any login to the admin interface and run any update, then redo these steps from scratch again.

Article Request Count:
Posted here:
05 Jun 2005

You know you want to visit the Archives.
Published with Textpattern