Most of the bloggers keep blog into sub-domain but get the more SEO benefits and increase page rank of the site, sub-directory is good rather than sub-domain. One more reason is inbound links to sub-domains are preserved differently to links which point to the root directory and Sub-domains are less trusted than sub-directories in Google.
However, If you move WordPress blog or forum from sub-domain to sub-directory, it’s easy to move blog to new location but main issue is your blog URLs are submitted into Google and other search engines so until newly generated sitemap not submitted to Google, user will get “not found” link from Google and which affects your site popularity, backlinks and traffic from search engines too.So, It’s necessary that no broken links or 404 errors found.
Today I am going to explain about how to move the WordPress blog to a new sub-directory from sub-domain with considering SEO benefits so visitors will not get “Not found” link till Google does not upgrade links into search engine.
Next is the permanent redirection of URL from sub-domain to sub-directory. To move all old previous sub-domain URL’s to the new sub-directory structure, You need to write below
.htaccess code which automatically redirects to sub-directory rather than manually adding redirection code for each and every URLs.
RewriteRule ^(.*)$ http:/ /
/$1 [R=301,L] RewriteRule ^(.*)/([a-zA-Z0-9_-]+)$ http:/ / /([a-zA-Z0-9_-]+)$1 [R=301,L]
Last but not the least, update your XML sitemap and make sure old URL’s are removed from Google search engine otherwise it leads to the duplicate content issue.
To add new URL rewrite rule in WordPress
I’m hoping that you’ve found this article helpful. Don’t hesitate to use this code in your WordPress projects and post your comments if you need help. As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.