Prem Tech
Prem Tech

Reputation: 1

How to redirect these old urls to new ones (subfolder) via htaccess

I am a newbie and would like to redirect all my old urls to new ones (moved as subfolder) via htaccess. Also, with 301 permanent redirect.

Old url pattern looks like: http://www.mydomain.com/de/myoldpage.html New url pattern should be: http://www.mydomain.com/shop/de/myoldpage.html

I am using the same domain and same page urls but only my shop is moved to a subfolder "shop". How can i write a redirect rule to redirect all the urls in this pattern.

Thanks in advance.

Upvotes: 0

Views: 516

Answers (2)

anubhava
anubhava

Reputation: 786111

Try this code in your .htaccess file:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteRule ^(de/.*)$ /shop/$1 [L,R=301,NC]

Upvotes: 2

mistagrooves
mistagrooves

Reputation: 2337

RewriteEngine On
RewriteRule ^de/(.*)$ shop/de/$1 [L,R]

Upvotes: 0

Related Questions