WP subdirectory incorrectly redirecting to our second domain, despite everything

My company is trying to update their website, switching to wordpress. We own two domains each originally pointing to two sites, lets call them site1.com and site2.com. site2 is more up to date, but we don’t like the url anymore, so we want to update site1 to become the new site.

Intended Setup
1. Redirect site1.com to site2.com, but only the root domain.
2. Install wordpress at site1.com/wp, which should still be accessible so that my colleagues and boss can send me feedback.
3. Once the site was fully developed in a few weeks, turn off the first redirect, then move the wordpress to the root domain.

I managed to make site1.com redirect to site2.com. However, no matter what I do site1.com/wp seems to also redirect to site2.com.

1. I’ve tried removing all redirects both by editing it on cpanel, as well as directly editing the .htaccess files. Somehow, what happens instead is that while i’m able to remove the redirect from the root site1.com to site2.com, site1.com/wp’s redirect somehow still persists.

Current public_html .htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^site1.com$ [OR]
RewriteCond %{HTTP_HOST} ^site1.com$
RewriteRule ^/?$ "https://www.site2.com/" [R=301,L]

Current /wp subdirectory .htaccess:

# 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]

# END WordPress

2. I am clearing my dns cache by entering ipconfig /flushdns between attempts.

3. Under my wp_options (wpor_options in my case), the following are set:

siteurl - https://site1.com/wp
home - https://site1.com/wp

Source link