Redirect wordpress pages to new location on same site

#USER ADDED PAGE REDIRECTS
redirect 301 /widgets/all-about-widgets /widgets/all_about_widgets/all-about-widgets
redirect 301 /widgets/widgets-what-are-they-good-for /widgets/all_about_widgets/widgets-what-are-they-good-for
#USER ADDED END

#BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#END WordPress
Same example if your wordpress is in a sub directory
#USER ADDED PAGE REDIRECTS
redirect 301 /wordpress_sub_directory/widgets/all-about-widgets /wordpress_sub_directory/widgets/all_about_widgets/all-about-widgets
redirect 301 /wordpress_sub_directory/widgets/widgets-what-are-they-good-for /wordpress_sub_directory/widgets/all_about_widgets/widgets-what-are-they-good-for
#USER ADDED END

#BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress_sub_directory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress_sub_directory/index.php [L]
</IfModule>
#END WordPress
Redirect wordpress category (directory) change
#USER ADDED CATEGORY DIRECTORY REDIRECTS
RewriteEngine on
RewriteBase /
RewriteRule ^my-directory-name/(.*) /my-new-directory-name/$1 [R=301,L]
RewriteRule ^my-directory-name/my-sub-directory-name/(.*) /my-new-directory-name/my-new-sub-directory-name/$1 [R=301,L]
RewriteRule ^my-directory-name/(.*) nttps://mynew-domain/my-new-directory-name/$1 [R=301,L]
#USER ADDED END
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *