htaccess 重定向某些部分 url 301 SEO

htaccess redirect some partical url 301 SEO

我们博客 URLS 上的某些内容已更改。 不,我想在网址中删除一些 URL 路径。

示例:

旧 URL: https://do-main.de/blog/条目/die-xxx-der-portrait

新URL: https://do-main.de/blog/die-xxx-der-portrait

我的 htaccess 尝试设置:

#OLD BLOG URLS
RewriteEngine On

# anything that is equal to https://do-main.de/blog/entry/*
RewriteCond %{HTTP_HOST} ^do\-main\.de\/blog\/entry\/$

# redirects to https://do-main.de/blog/*
RewriteRule ^/?(.*)$ https://do-main.de/blog/ [R=301,L]

结论所有 URLS with "entry" 应该只使用 /blog/ 而没有 /entry/ 你明白吗?谁能帮忙?

您可以使用 Redirect 指令。

Redirect 301 /blog/entry/ http://example.com/blog/

这会将所有请求从 example.com/blog/entry/foobar 301 重定向到 http:// example.com/blog/foobar