random redirect to root site

I have a site at http://www.targetremarket.com/

This may be difficult to troubleshoot but maybe its something you have seen before and know what causes it?

I am often logging and out and at times checking pages on other sites so sometimes when I enter a link to go to a specific site such as:
http://www.targetremarket.com/joanne/

It will redirect to the root site http://www.targetremarket.com/ instead ?
Now if enter the url a second time and it goes that correct sub-site. The second attempt ALWAYS works.

Its difficult to reproduce, just happens occasionally and had someone else in another state sharing a screen it was happening for them as well.

Has anyone ever seen this? I know its customary to remove all plugins and re-activate one by one but that is not fun :slight_smile: Since it is difficult to reproduce not sure what to do?

thanks!

  • Nithin

    Hey George,

    Hope you are doing good today. :slight_smile:

    This is quite odd, since you aren't able to replicate this issue always. I haven't notice such issue in the forums too, have you checked whether any plugin is causing this issue, by running a quick plugin/theme conflict test as illustrated in getting support manual (flowchart)?:
    http://premium.wpmudev.org/manuals/using-wpmu-dev/getting-support/

    If the plugin conflict doesn't help, please check whether your .htaccess is having any rules which is causing this, for a subfolder install, please check whether this is the rules in your .htaccess file, the file is located in your root directory:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    If you still have issues, even after following the above instructions, please enable support access, so that we could give a closer look. You can grant access from WPMU DEV > Support > Support Access > Grant Access, or check this manual: http://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Please let us know once you enable access, so that we could get this sorted. Have a nice day :slight_smile:

    Kind Regards,
    Nithin

  • George

    I checked my htaccess and its good and I am not in a sub folder. However, I have also noticed other issues :slight_frown:

    In my root site some images are not showing and if I go to the media library, some images are just showing a blank place holder and not the image. It seems its just images related to my homepage but not sure.
    If I delete the image and try to re-upload I get:

    “CoupleonLaptopinKitchen.jpg” has failed to upload.
    The uploaded file could not be moved to uploads/2015/02.

    Checked my file permissions and they look normal.

    In network admin it shows I need to upgrade the db and tried that and I get this error:
    Warning! Problem updating . Your server may not be able to connect to sites running on it. Error message: A valid URL was not provided.

    Its a fairly new install and only have a few sub sites created.

    I tried disabling, actually I deleted all the plugins and the problems still persist.

    I have enabled support access, perhaps you could have a look?

    thanks!!

  • George

    So I found something in the options tables, it wasnt the url but the address on the server like home/username/public_html and it had the wrong username.

    I created the site on another domain and then moved it here and didn't realize that path was in the options table. The site was still on the same server so I guess it still worked initially?

    Still couldn't get my database to update though so just did a clean install of WP & imported my pages since I only had a few sites.

    Will mark as solved.

  • Kasia Swiderska

    Hello George,

    I checked http://www.targetremarket.com/joanne/ and there is no redirects (I checked in two different browsers).
    Is it still doing that on your side? have you tried to clear browser cache and cookies?

    If yes, would you mind allowing support access so we can have a closer look at this (access now is not working)?
    To enable support access you can follow this guide here:
    http://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    kind regards,
    Kasia

  • George

    OK access granted, I forgot to being able after I reinstalled everything. I have tried clearing cache different browsers having my friends and other states on different computers try it and they were able to replicate. just tried on a brand new computer going to Targetremarket.com/butch
    that one seems to be doing it every time. however only happens the first time you go to that url. I tried a second time and it works. so you think everything is fixed because you can't replicate the issue. Th. en few days later every time you go to a new sub site url it happens again? I was able to replicate several times just now with that sub-site Butch

    it's tough to replicate because it only happens the first time you visit that Url of the sub site.
    thanks for looking into it

  • Rupok

    Hi George,

    I searched with your issue and found one thread which gave me some idea about this: https://moz.com/community/q/my-page-has-a-302-redirect-and-i-don-t-know-how-to-get-rid-of-it

    And I checked your site with some online tools and got this:

    >>> http://targetremarket.com/butch
    > --------------------------------------------
    > 302 Moved Temporarily
    > --------------------------------------------
    Status:	302 Moved Temporarily
    Code:	302
    Date:	Mon, 12 Dec 2016 06:55:03 GMT
    Server:	Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.1e-fips mod_bwlimited/1.4
    X-Powered-By:	PHP/5.4.39
    Location:	http://www.targetremarket.com/
    Content-Length:	0
    Connection:	close
    Content-Type:	text/html
    
    >>> http://www.targetremarket.com/
    > --------------------------------------------
    > 200 OK
    > --------------------------------------------
    Status:	200 OK
    Code:	200
    Date:	Mon, 12 Dec 2016 06:55:04 GMT
    Server:	Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.1e-fips mod_bwlimited/1.4
    X-Powered-By:	PHP/5.4.39
    Link:	<http://www.targetremarket.com/wp-json/>; rel="https://api.w.org/", <http://www.targetremarket.com/>; rel=shortlink
    Connection:	close
    Content-Type:	text/html; charset=UTF-8

    So your subsite clearly sets a 302 redirect to your main site but I was not sure what could be causing this.

    Then something came up on my mind. I went to "http://targetremarket.com/butch/" [Please note, there is no "www" part] and I was taken to "http://www.targetremarket.com/". This happens every time. Then I went to "http://www.targetremarket.com/" [Please note, this time with "www" part], and now I'm not being redirected to anywhere. I confirmed this from this site: http://www.redirect-checker.org/index.php

    Then I found that any URL on your network without the "www" is being redirected to your main site. Can you please check if there is something set in your DNS or cPanel which is redirecting all non-www links to your homepage? Can you please talk to your host regarding this?

    As a quick workaround, can you please move your whole network to non-www instance? To know how you can do that, can you please check this guide? https://wpengine.com/support/how-to-change-a-multi-site-primary-domain/ For your case, you should be replacing "www.targetremarket.com" with "targetremarket.com". I believe, that will resolve your issue.

    Please NOTE: I'll suggest you to create a full backup of your network before trying this so you can always revert back to current state if anything goes wrong.

    Please let us know what you think about this. I'm looking forward to hearing from you and resolving this issue as soon as possible.

    Have a nice day. Cheers!
    Rupok

  • George

    Thank you Rupok, I didn't notice the www redirect so had no idea what to check. I did update the url in some of the tables in the DB which corrected the problem so all links work now.

    I have a dedicated server and some some other multisites that I setup that don't redirect but the last 2 I setup on different domains/accounts both redirect to the home site if 'www' is not used.

    I will run this by the guys that manage my server for me and see if they can explain the cause.

    Thanks again!!

  • George

    I guess I didn't fix everything. Now in my admin menu if you go to network>users or network>sites or anything in the network menu the link does not have a www so when you click it, you are logged out.

    I changed the links in the db to not include the www since I had the redirect issue.

    After updating some pages I have some images not showing and if you go the media library they are just grey squares.

    I guess my first move is try a backup of the site on another server and see if it still has the redirect issues. I am at a loss and not sure what my next move should be?

    I have already re-installed wordpress and re-ported all my pages. Any advice?
    I will keep support enabled.
    thanks!!!

  • George

    Sorry one more update.
    As you can see from previous posts I was making changes to the db and I am just getting screwed up worse.

    So I have restored a backup to another domain and enabled support at bc360ads.com
    I would like to fix the redirect issue.

    If you enter a site without the www as mentioned earlier it redirects to the homepage.
    So bc360ads.com/joanne redirects to http://www.bc360ads.com (the homepage and the www is added)

    I thought maybe its something on my dedicated server since it is located at godaddy so also moved the site another server on another host at virtualgeorge.xyz and also enable support access there.

    It has the same issue, enter a url without a www. and it redirects to the homepage.

    Using the 2 additional sites for testing is there anyway to determine what is causing the redirects?

    thanks!
    -George

  • Rupok

    Hi George,

    This is really weird. However, I can try to fix this for you but for that, I'll need some information. Can you please confirm on which site do you want me to try first? "bc360ads.com" or "targetremarket.com" ? And then, I'll need your FTP and WordPress network admin login credentials for that site. Can you send me message with FTP and Network Admin access credentials through our secure contact form here: https://premium.wpmudev.org/contact/ ?

    Subject: "Attn: Rupok"
    - FTP Username
    - FTP Password
    - FTP Host
    - WordPress admin Username
    - WordPress admin Password
    - Login URL
    - Link back to this thread for reference
    - Any other relevant URLs

    Select "I have a different question" for your topic. This and the subject line ensure that it gets assigned to me.

    Please NOTE: I'll request you to take a full backup of your site with database before sending me the credentials because things may go wrong during testing and trying as this is a complex issue and if you have a full backup, you can always revert back to current scenario if anything goes wrong.

    I'm looking forward to hearing from you and resolving this issue as soon as possible.

    Have a nice day. Cheers!
    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.