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.
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.
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:
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!
First and foremost, we start by opening up index.php and find the line that states:
Change it to read:
As an example, if you are on a standard Apache install this would look something like:
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:
(see above for example)
This has been moved to your root folder of your normal textpattern site, so open that one and change the line:
to (yes, you guessed it allready):
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;
textpattern/ text from it so they both read:
if ($n) return hu.'css.php?n='.$n;
Here you find the line that reads:
and change it to:
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.
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.
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.