问题描述
我在Amazon EC2上安装了Ubuntu的汇出字preSS实例。
I installed a Bitnami Ubuntu Wordpress instance on Amazon EC2.
在字press.conf
在汇出实例文件的行为像一个htaccess文件。
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
在字press.conf
文件包含
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/word$p$pss/
我想它是(包括查看单个帖子时):
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
等
任何人都知道如何使这种变化?
Anyone know how to make this change?
推荐答案
在该文件中,你需要改变:
In that file you will need to change:
Alias /wordpress/ "/opt/bitnami/apps/wordpress/htdocs/"
Alias /wordpress "/opt/bitnami/apps/wordpress/htdocs"
到
Alias /blog/ "/opt/bitnami/apps/wordpress/htdocs/"
Alias /blog "/opt/bitnami/apps/wordpress/htdocs"
通过这种变化Apache将服务于字preSS在 /博客
。
With that change apache will serve wordpress in /blog
.
然后,你还需要修改重写规则在该文件中(因为新的URL会使用,而不是 /字$ P $
)。 /博客
PSS
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]
到
RewriteBase /blog/
RewriteRule . /blog/index.php [L]
最后,您将还需要修改的wp-config.php文件
文件(在应用程序/字preSS / htdocs目录
)确保了 WP_SITEURL
和 WP_HOME
网址指向 /博客
。
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');
这篇关于的.htaccess改写为托管在汇出/ EC2字preSS主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!