重定向太多 - htaccess / Wordpress

时间:2017-12-27 16:07:48

标签: wordpress .htaccess redirect

似乎得到了太多的重定向"尝试从旧站点放置所有301s时出错。它似乎特别适用于子文件夹中的任何页面(即博客)

尝试通过强制非www over https开始。然后重定向具有URL更改的单个页面。

htaccess目前看起来像这样:

RewriteEngine On

# Yoast SEO - XML Sitemap Rewrite Fix
RewriteBase /
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
# END Yoast SEO - XML Sitemap Rewrite Fix

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Options +FollowSymLinks

# match any URL with www and rewrite it to https without the www
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]

# match urls that are non https (without the www)
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Original Site Redirects (From the previous website)

Redirect 301 /tell https://example.com/contact
Redirect 301 /blog https://example.com/blog
Redirect 301 /sitemap https://example.com/sitemap_index.xml
Redirect 301 /blog/asking-help https://example.com/asking-for-financial-help
Redirect 301 /blog/planning-special-needs https://example.com/financial-planning-for-special-needs

什么工作:

  • 非www,https强制按预期工作。
  • 联系人,博客和站点地图都正确重定向。

什么不行?

  • 据我所知,任何从原始博客文件夹重定向的内容都会导致重定向过多而且#34;错误 - 上面的例子中的博客/询问帮助和博客/计划特殊需求。

我在俯瞰什么?

0 个答案:

没有答案