Quantcast
Channel: Wordpress – The Awkward Geek
Viewing all articles
Browse latest Browse all 15

The Best Little Known WordPress Installation Hack

$
0
0

I’ve always wanted to write about this but I’ve always kept putting it aside until now. Every once in a while, I have people asking me how to go about installing WordPress on their new webhost. While the general consensus of the public wants their WordPress installation done in a single click, I’ve always been an advocate for a much more manual approach. Whether by uploading via FTP or directly transferring it from the WordPress repositories themselves via SSH, I’ve always believe that in being hands on with WordPress, you can begin to appreciate the code and understand how your blog actually works.

In any case, I found out about this WordPress installation hack quite by accident after playing around with it after a while. It’s simple enough for anyone to do and you can actually do it long after you’ve installed WordPress on your webhost.

The problem with the default WordPress installation, regardless of whether it’s automatic of manual is that it comes in two flavours. Your blog domain either looks like this:

http://blogdomain.com

Which means that all your WordPress files are located on the webhost root itself for all to see. Or if you decided to put your WordPress files into a folder of its own (like me), your domain name for your blog ends up looking like this:

http://blogdomain.com/wordpressfoldername

What a lot of people want however for their blog to be in a single folder, yet be able to display their blog in their root domain. In which case, it is as simple as a these next steps.

Fresh WordPress Install:

  1. Follow the standard WordPress installation method as usual whether via FTP or SSH, but install WordPress into a folder of its own within the root so it looks like this:

    http://blogdomain.com/wordpressfoldername

  2. Extract or download the “index.php” file from either the WordPress zip file or from where you uploaded your WordPress files to.
  3. Open the “index.php” file using your text reader like notepad.
  4. You should see a line that says:

    require(‘./wp-blog-header.php’);

    Edit that line so it says something like:

    require(‘./wordpressfoldername/wp-blog-header.php’);

  5. Save and upload the newly edited “index.php” file to your root domain so the index is located outside the WordPress folder
  6. After you completed your WordPress installation, log into your Admin panel and go straight to your Options. There you will see two lines, your WordPress Address and your Blog Address. Both should be showing the same URL. Change only your Blog Address from:

    http://blogdomain.com/wordpressfoldername

    to

    http://blogdomain.com/

    Save your changes.

Old WordPress Install:

  1. Open your server’s FTP and check where your WordPress files are. If they are in a folder of their own, make a note of the folder name and skip step 3 and go straight to step 4. If not, then follow step 3.
  2. Log into your Admin panel and go straight to your Options. Change only your Blog Address from:

    http://blogdomain.com/wordpressfoldername

    to

    http://blogdomain.com/

    Save your changes.

  3. (Alternate) If your WordPress files are not in their own folder, create a new folder within your root, then shift all your WordPress files and folders except for your “index.php” and your “.htaccess” into the new folder.
  4. Extract or download the “index.php” file from either the WordPress zip file or from where you uploaded your WordPress files to.
  5. Open the “index.php” file using your text reader like notepad.
  6. You should see a line that says:

    require(‘./wp-blog-header.php’);

    Edit that line so it says something like:

    require(‘./wordpressfoldername/wp-blog-header.php’);

  7. Save and upload the newly edited “index.php” file to your root domain so the index is located outside the WordPress folder

That’s it really. Remember, all your posts and comments are stored in your WordPress database and not your FTP, so shifting them either way would not cause you to lose them. Now your WordPress would be conveniently located within a folder of its own and your domain name would still be pointing to its own address. You don’t have to mess around with 301 redirects or anything or that sort and your site map would be much neater and more secure.

The upside is that because your WordPress files are in a folder of their own, you can add more folders to the root, maybe even install an onsite gallery or a forum in its own folder in same place where you can link your blog to it. The possibilities are endless and it’s testament to the worth of spending a little extra time to get to know how your own blog works.


Viewing all articles
Browse latest Browse all 15

Trending Articles