I am using this tutorial Giving WordPress Its Own Directory to launch a WordPress (installed in a sub folder called wordpress) by using example.com instead of example.com/wordpress.

It says to copy index.php to your root folder and change the relative path to wp-blog-header.php accordingly. However, my folder structure is a little complex:

Folder Structure

To access site root I go to example.com. But to access WordPress I have to go to example.com/wordpress (if anyone wondering why I am using Bitnami WordPress stack AMI and thus everything came pre-configured)

According to tutorial I should copy index.php to site root from WordPress root and change relative location of wp-blog-header.php accordingly. When index.php was in same directory the function was require('./wp-blog-header.php') . Now this location is to be changed

I have tried all three options I could think of:

  1. ../apps/wordpress/htdocs/wp-blog-header.php

  2. ./wordpress/htdocs/wp-blog-header.php

  3. wordpress/htdocs/wp-blog-header.php

But visiting the domain root gives a server error. Any suggestions?

3 Answers 3


I think you need to use:

define("ROOT", realpath(dir(__file__)) . "/");
require(ROOT . "apps/wordpress/htdocs/wp-blog-header.php");

Got this from the PHP.Net site however haven't used the code (Or use this type of code often) so can't guarantee it will work.



Here is the answer http://wiki.bitnami.org/Components/Apache#How_to_change_the_URL.3f it was because of bitnami and not a fault of wordpress


I have used a setup similar to this on a different server. You need to code the full path to the WordPress installation into the require function. On a regular server this would start with /home/username/.

If you don't know the full path, you can use the dirname() function:

require( dirname( dirname( __FILE__ ) ) . '/apps/wordpress/htdocs/wp-blog-header.php');

The first call to dirname( __FILE__ ) returns the path to the htdocs (site root) folder. The second exits that folder to the Bitnami root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.