Alex
Alex

Reputation: 1497

htaccess rule to redirect old blog urls to the new url

I have a Wordpress blog at the following URL:

www.example.com/Folder1/blog

I want to move it up one folder to:

www.example.com/blog

After moving all Wordpress files, I want to write a .htaccess rule that will redirect ALL my old links to the new ones automatically, like:

www.example.com/Folder1/blog/article-one

to

www.example.com/blog/article-one

I've tried a lot of .htaccess rules, but none of them worked. Can someone help?

Upvotes: 1

Views: 152

Answers (2)

anubhava
anubhava

Reputation: 785028

Inside /Folder1/.htaccess place this rule:

RewriteEngine On

RewriteRule ^(.*)$ /$1 [R=302,L,NE]

Upvotes: 1

Sim1
Sim1

Reputation: 532

Try this sample code:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^folder1.*$ http://example.com/folder2/ [R=301,L]

source

Upvotes: 0

Related Questions