I moved WordPress out of the root of my server into a special folder of its own and now Google is indexing my posts together with that special WordPress folder thus creating some 404 error issues.
For example let's say my WordPress core files are installed in /
but the home page is /
.
This post link /
works fine and has been indexed by Google. Unfortunately, Google is also indexing ://www.example/hello-world/435/
thus creating 404 errors in Google Search console.
So my question is, is there a way to use .htaccess
to make links like ://www.example/hello-world/435/
to redirect to the right link which is /
?
I moved WordPress out of the root of my server into a special folder of its own and now Google is indexing my posts together with that special WordPress folder thus creating some 404 error issues.
For example let's say my WordPress core files are installed in https://www.example/wordpress/
but the home page is https://www.example/
.
This post link https://www.example/hello-world/435/
works fine and has been indexed by Google. Unfortunately, Google is also indexing https://www.example/wordpresshttps://www.example/hello-world/435/
thus creating 404 errors in Google Search console.
So my question is, is there a way to use .htaccess
to make links like https://www.example/wordpresshttps://www.example/hello-world/435/
to redirect to the right link which is https://www.example/hello-world/435/
?
1 Answer
Reset to default 0I've fixed it using the rule below
RewriteRule ^(.*)wordpresshttps:/www.example/(.*)$ https://www.example/$2 [L,R=301]