0

So I have bitnami's LAMP stack running, and I have a wordpress module installed within it.

I want my wordpress installation to live at blog.example.com, and any wordpress links to remain under blog.example.com/xyz, and not to redirect to example.com/wordpress.

I've tried so many configurations of virtual hosts, and I have managed to get blog.example.com to load the wordpress landing page, but any links take me to example.com/wordpress/ (I have tried updating the site and home urls in the database). Other configurations have caused me to fall into a redirect loop when loading the page, often looking like example.com/wordpresswordpresswordpress... - I'm guessing this is caused by a rewrite condition not terminating. I've also followed the guides on the bitnami wiki (though I suspect they don't make much sense anyway).

If you know how bitnami and wordpress play together, I would really appreciate a breakdown of what I need to do to get my wordpress module behaving itself. (You can assume there's nothing to backup). Thanks :)

2
  • 2
    What do you have for a config now? May 13 '14 at 19:43
  • Currently a fresh bitnami install with url and site changed to blog.mydomain.com in wp-config.php, and a vhost entry in bitnami-lamp/apps/wordpress/conf/httpd-vhosts.conf which describes a servername and alias of blog.mydomain.com listening on *:80
    – Chironex
    May 16 '14 at 17:06
2

I really don't know about Bitnami, but to add WordPress to a sub directory, you need two things:

  • a index.php in the root dir containing nothing than the following:

    <?php
    define('WP_USE_THEMES', true);
    require( dirname( __FILE__ ) . '/YOUR-SUB-DIR/wp-blog-header.php' );
    
  • In case you are using Apache, a .htaccess file containing the following:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$
    RewriteRule ^(/)?$ YOUR-SUB-DIR [L]
    RewriteRule . index.php [L]
    

Basically that's it. I can't tell you how to set it up on lighttp or nginx, but above is a sure shot on Apache with a single site install. If you are moving to a multisite/network install, you will have to set the relevant constant in your installs wp-config.php file, active the network through the admin UI and then follow the steps to update your .htaccess and wp-config.php file.

EDIT You want

blog.example.com

as your main domain - so add it as such in the WP admin UI settings. It seems you got a single site install, but "any wordpress links to remain under blog.example.com/xyz" is pretty cryptic in WordPress terms. Permalink structure is what you choose under "admin > Settings > Permalinks". If the site redirects you to example.com?query=arg, then you obviously have set example.com as your WordPress main domain.

1
  • Hi, If I want my blog to be accessible directly from blog.mydomain.com, such that visiting www.mydomain.com will take me to a different page (unrelated to wordpress). I attempted to resolve this by creating a vhost with servername blog.mydomain.com, but the page fails to load css and js resources because the vhost is suffixed with a wordpress/, and the requests are prefixed with wordpress/, my hackfix is a symlink within wordpress to its parent. This arrangement grosses me out and I was hoping for something better. Does that make sense or did I miss something from your answer?
    – Chironex
    May 16 '14 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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