$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>redirect - How To Fix 404 errors caused by Google Indexing Wordpress In Subdirectory|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin8PV0评论

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]
Post a comment

comment list (0)

  1. No comments so far