• Resolved telehax

    (@telehax)


    Backstory:
    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]
    </IfModule>
    
    # 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
Viewing 3 replies - 1 through 3 (of 3 total)
  • if you need to redirect site1 to site2, then you can use this method:

    <?php header("Location: http://www.site2.com/wp"); ?>

    and insert this code to your index.php file of the site1.

    Thread Starter telehax

    (@telehax)

    My current problem is that I cannot turn off the redirect from site1.com/wp to site2.com.

    I have tried removing the redirect from site1.com to site2.com and even that does not seem to cancel it- what instead happens is site1.com no longer redirects to anything but site1.com/wp still redirects to site2.com despite the htaccess not even mentioning either.

    Thread Starter telehax

    (@telehax)

    I solved it.

    Apparently, it is not enough to clear your DNS cache. Chrome has a 301 Redirect Cache which recorded the 301 redirect from a previous botched install.

    My second computer didn’t work either as I had accessed site1.com/wp at some point during the whole set-up process, so chrome on that computer also possessed the old redirect cache.

    So I needed to clear both the DNS Cache as well as the browser 301 redirect cache. (Google “clear browser 301 redirect cache”) before it reflected the current .htaccess files properly.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP subdirectory incorrectly redirecting to our second domain, despite everything’ is closed to new replies.