Solution:
I think there might be a problem with your rewrite in the subdirectory. First I presume you want to keep the same link. If we look at the tutorial linked there is only need for one .htaccess in the root directory.
Since if a request is made anywhere on the site and if it’s not a direct file or directory the root htaccess file will redirect it to the subfolder.
Now, your second subfolder .htaccess file is actually pointing back to the root directory. If you want to have a .htaccess redirect in the subfolder you should add the rewrite base and the subfolder to the redirect.
# Force SSL
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp_dir/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp_dir/index.php [L]
</IfModule>
# END WordPress
- If you look at this Hostinger tutorial it suggests you shouldn’t use the RewriteEngine On condition twice. And this is a nice explanation of this “problem”.
But summery if you use RewriteEngine or RewriteBase multiple times the last entry wins and is used throughout the .htaccess file.
Now I don’t understand did you access https://example.com/wp_dir/ directly or were you redirected there? If it was direct access I think the .htaccess was wrong as I pointed out.
Or it may be the phone cache.
Edit: And also modify the first .htaccess file. I think one https rewrite rule is redundant and another incorrect.
# SSL rewrite
RewriteEngine On
# RewriteCond %{SERVER_PORT} 80
# I think this shouldn't matter but lets use the same method for consistency
RewriteCond %{HTTPS} Off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NE]
RewriteBase /
# RewriteEngine is already On
# RewriteEngine On
# non-www
# RewriteBase /
# RewriteBase is already defined
# if we want to redirect to https lets specify that
#RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
#RewriteCond %{HTTPS} OFF
# RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
#RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
# But I think the very first directive should take care of this
# If we're using https why redirect to it?
# Or am I missing something?
#RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
#RewriteCond %{HTTPS} ON
#RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/wp_dir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp_dir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ wp_dir/index.php [L]
</IfModule>
File as I’d put it
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} Off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NE]
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/wp_dir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp_dir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ wp_dir/index.php [L]
</IfModule>
I may be wrong.