redirect - How To Fix 404 errors caused by Google Indexing Wordpress In Subdirectory

admin2025-06-04  48

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/?

Share Improve this question edited Jan 10, 2019 at 0:37 MrWhite 3,8911 gold badge20 silver badges23 bronze badges asked Jan 9, 2019 at 13:53 UdegbunamChuksUdegbunamChuks 113 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 0

I've fixed it using the rule below

RewriteRule ^(.*)wordpresshttps:/www.example/(.*)$ https://www.example/$2 [L,R=301]
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749027166a315739.html

最新回复(0)