Ad

Htaccess Redirect Some Partical Url 301 SEO

- 1 answer

something on our BLOG URLS have changed. No i want to have some URL path deleted in urls.

Example:

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

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

My htaccess attempt to setup:

#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/$1 [R=301,L]

conclusion all URLS with "entry" should be only using /blog/ without /entry/ Do you understand? Can anyone help?

Ad

Answer

You can use Redirect directive.

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

This will 301 redirect all requests from example.com/blog/entry/foobar to http:// example.com/blog/foobar .

Ad
source: stackoverflow.com
Ad