【问题标题】:How to configure a redirect from www on a server Amazon?如何在亚马逊服务器上配置来自 www 的重定向?
【发布时间】:2015-02-21 09:50:38
【问题描述】:

我们通过 Amazon Bitnami 在服务器上放置了一个网站 (Wordpress)。 我们尝试设置从 www.site.com 到 site.com 的重定向(删除“www”)。 但是,它现在从任何 www 子页面重定向到主页 www.site.com(而不是正确的子页面)。 (从 www.site.com/page 到 site.com 而不是到 site.com/page) 如何设置带有 www 子页面的重定向到没有 www. 的站点的同一页面?

我在 Apache httpd.conf 文件中添加了代码。 LoadModule rewrite_module modules/mod_rewrite.so

AllowOverride controls what directives may be placed in .htaccess files. It can be "All", "None", or any combination of the keywords: AllowOverride FileInfo AuthConfig Limit

`AllowOverride All` 

也被编辑过的文件:.htaccess、httpd-app.conf、httpd-vhosts.conf

【问题讨论】:

    标签: wordpress apache .htaccess redirect bitnami


    【解决方案1】:

    它可能只是一个 htaccess 问题。尝试在您的 htaccess 中使用此代码,将 example 替换为您的站点名称

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    RewriteRule ^index\.php$ - [L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-06
      • 1970-01-01
      • 2013-07-12
      • 2011-10-26
      • 1970-01-01
      • 2019-04-23
      • 1970-01-01
      相关资源
      最近更新 更多