如何在Bitnami Wordpress中设置重写规则 [英] How to set a rewrite rule in Bitnami Wordpress

查看:83
本文介绍了如何在Bitnami Wordpress中设置重写规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 bitnami apache2 wordpress网站.

I have a bitnami apache2 wordpress site.

我的 htdocs 位于/opt/bitnami/apps/wordpress/htdocs 目录中,并且其中的所有内容已移至该目录称为 blogs ,它与以下相同的 htdocs :

my htdocs is in the /opt/bitnami/apps/wordpress/htdocs directory and everything inside that has been moved to a directory called blogs which is in the same htdocs as below:

/opt/bitnami/apps/wordpress/htdocs/
                                  /blogs
                                    - contents

现在,当我访问 blog.mydomain.com 时,它会给出 File权限错误,如下所示:

And now when I access blog.mydomain.com it gives the File permission error as below:

禁止访问您没有访问此资源的权限.

Forbidden You don't have permission to access this resource.

但是当我访问 blog.mydomain.com/blogs 时,我可以看到内容.

But when I access blog.mydomain.com/blogs I can see the content.

所以,当有人点击时,我如何 blog.mydomain.com 重定向到 blog.mydomain.com/blogs blog.mydomain.com

So, how I can redirect from blog.mydomain.com to blog.mydomain.com/blogs when someone hits blog.mydomain.com

推荐答案

Bitnami开发人员在这里!

Bitnami developer here!

如果您不打算将主域用作双重网站设置,则可以使用VirtualHost中的 RedirectMatch 指令简单地执行重定向.

If you don't plan to use the main domain as a double website setup, you could simply perform a redirection using the RedirectMatch directive in your VirtualHost.

如果您使用实例的原始VirtualHost设置,请将以下行添加到/opt/bitnami/apache2/conf/bitnami/bitnami.conf :

If you use the original VirtualHost setup of the instance, add the following lines to /opt/bitnami/apache2/conf/bitnami/bitnami.conf:

...
<VirtualHost _default_:80>
+ RedirectMatch ^/$ /blog/
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  <Directory "/opt/bitnami/apache2/htdocs">
  ...
</VirtualHost>
...
<VirtualHost _default_:443>
+ RedirectMatch ^/$ /blog/
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  SSLEngine on
  ...
</VirtualHost>
...

说明:当当前网址与您的域名的根域 http(s)://YOUR-DOMAIN/相匹配时,服务器将重定向到第二个参数指令 http(s)://YOUR-DOMAIN/blog

Explanation: When the current URL matches the root of your domain, http(s)://YOUR-DOMAIN/, the server will redirect to the second argument of the directive, http(s)://YOUR-DOMAIN/blog

如果使用其他VirtualHost设置,只需在此处进行此修改即可.

If are using another VirtualHost setup, just place this modification there.

这篇关于如何在Bitnami Wordpress中设置重写规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆