Reputation: 9909
I installed a Bitnami Ubuntu Wordpress instance on Amazon EC2.
The wordpress.conf
file on a Bitnami instance acts like an htaccess file.
The directory structure is as follows:
/opt/bitnami/apps/wordpress/htdocs/index.php
The wordpress.conf
file contains
Alias /wordpress/ "/opt/bitnami/apps/wordpress/htdocs/"
Alias /wordpress "/opt/bitnami/apps/wordpress/htdocs"
<Directory "/opt/bitnami/apps/wordpress/htdocs">
Options Indexes MultiViews +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</Directory>
# Uncomment the following lines to see your application in the root
# of your URL. This is not compatible with more than one application.
#RewriteEngine On
#RewriteRule ^/$ /wordpress/ [PT]
This makes the blog appear with this URL
http://ec2instance.com/wordpress/
I would like it to be (including when viewing individual posts):
http://ec2instance.com/blog/
http://ec2instance.com/blog/post-number-1
http://ec2instance.com/blog/post-number-2
etc
Anyone know how to make this change?
Upvotes: 0
Views: 3440
Reputation: 1501
In that file you will need to change:
Alias /wordpress/ "/opt/bitnami/apps/wordpress/htdocs/"
Alias /wordpress "/opt/bitnami/apps/wordpress/htdocs"
to
Alias /blog/ "/opt/bitnami/apps/wordpress/htdocs/"
Alias /blog "/opt/bitnami/apps/wordpress/htdocs"
With that change apache will serve wordpress in /blog
.
Then you need to change the rewrite rules also in that file (because the new urls will use /blog
instead of /wordpress
).
RewriteBase /wordpress/
RewriteRule . /wordpress/index.php [L]
to
RewriteBase /blog/
RewriteRule . /blog/index.php [L]
Finally you will need to modify also the wp-config.php
file (in apps/wordpress/htdocs
) making sure that the WP_SITEURL
and WP_HOME
urls points to /blog
.
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/blog');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/blog');
Upvotes: 3