Title: Redirection problem after moving wordpress to subdirectory
Last modified: July 18, 2017

---

# Redirection problem after moving wordpress to subdirectory

 *  [Deleted Account](https://wordpress.org/support/users/myst5243/)
 * (@myst5243)
 * [9 years ago](https://wordpress.org/support/topic/redirection-problem-after-moving-wordpress-to-subdirectory/)
 * I’m currently using WordPress 4.8 with permalink structure of [https://www.example.com/%category%/%postname%/](https://www.example.com/%category%/%postname%/).
   I also use [Redirection plugin](https://wordpress.org/plugins/redirection/). 
   After awhile, I decided to move my wordpress installation from Root to Subdirectory
   using [this tutorial from official wordpress.org](https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory).
   I followed exactly like first method. It works but from time to time I receive
   a lot of 404 errors log in Redirection plugin log and Google Search Console log.
 * I created subdirectory for wordpress using same name with domain name. Assume
   my domain is **[https://www.example.com](https://www.example.com)**. I created
   subdirectory name of **[http://www.example.com](http://www.example.com)**. Reason
   because I have multiple addon domains which I installed wordpress in similar 
   way. Only this main domain have problem.
 * **PROBLEM:** I often receive 404 errors log in Redirection plugin log and Google
   Search Console. Assume I have a page of _hahaha_ then my URL error look like 
   this _[https://www.example.com/www.example.com/category/hahaha/](https://www.example.com/www.example.com/category/hahaha/)_
   instead of _[https://www.example.com/category/hahaha/](https://www.example.com/category/hahaha/)_
   and this is happened everyday on many URL’s even newer posts. With exception 
   of my index.php where my [https://www.example.com/www.example.com/index.php](https://www.example.com/www.example.com/index.php)
   always redirect to [https://www.example.com/](https://www.example.com/) without
   any problem and no error logs.
 * **.HTACCESS On Root:**
 *     ```
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteCond %{HTTP_HOST} ^(www.)?example.com$
       RewriteCond %{REQUEST_URI} !^/www.example.com/
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
       RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
       RewriteRule ^(.*)$ /www.example.com/$1
       RewriteCond %{HTTP_HOST} ^(www.)?example.com$
       RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
       RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
       RewriteRule ^(/)?$ www.example.com/index.php [L] 
       </IfModule>
       ```
   
 * **.HTACCESS On Subdirectory:**
 *     ```
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{HTTPS} off
       RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
       </IfModule>
       # END HTTPS
   
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteRule ^index\.php$ - [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
       </IfModule>
       ```
   
 * **QUESTION:**
    How do I add a wildcard redirects which will redirect anything
   matching condition _[http://www.example.com/www.example.com](http://www.example.com/www.example.com)_
   to _[http://www.example.com](http://www.example.com)_
 * Example:
    - _[https://www.example.com/www.example.com/pageA/](https://www.example.com/www.example.com/pageA/)_
      to **[https://www.example.com/pageA/](https://www.example.com/pageA/)**
    - _[https://www.example.com/www.example.com/Category1/pageB/](https://www.example.com/www.example.com/Category1/pageB/)_
      to **[https://www.example.com/Category1/pageB/](https://www.example.com/Category1/pageB/)**
    - _[https://www.example.com/www.example.com/Category2/pageC/](https://www.example.com/www.example.com/Category2/pageC/)_
      to **[https://www.example.com/Category2/pageC/](https://www.example.com/Category2/pageC/)**
      and so on.
 * I’ll be honest. I do know how to redirect oldPage to newPage but seems this is
   out of my knowledge. I tried many tutorial on google and redirect generator etc
   but still I receive 404 error logs of that kind. Please help me. Thank in advance.
    -  This topic was modified 9 years ago by [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/).
    -  This topic was modified 9 years ago by [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/).
      Reason: add missing ul tag

Viewing 1 replies (of 1 total)

 *  Thread Starter [Deleted Account](https://wordpress.org/support/users/myst5243/)
 * (@myst5243)
 * [9 years ago](https://wordpress.org/support/topic/redirection-problem-after-moving-wordpress-to-subdirectory/#post-9328404)
 * UPDATE Because I cannot EDIT:
    `I created subdirectory for wordpress using same
   name with domain name. Assume my domain is https://www.example.com. I created
   subdirectory name of www.example.com. Reason because I have multiple addon domains
   which I installed wordpress in similar way. Only this main domain have problem.`

Viewing 1 replies (of 1 total)

The topic ‘Redirection problem after moving wordpress to subdirectory’ is closed
to new replies.

## Tags

 * [404-error](https://wordpress.org/support/topic-tag/404-error/)
 * [moving-wordpress](https://wordpress.org/support/topic-tag/moving-wordpress/)
 * [redirect](https://wordpress.org/support/topic-tag/redirect/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [Deleted Account](https://wordpress.org/support/users/myst5243/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/redirection-problem-after-moving-wordpress-to-subdirectory/#post-9328404)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
