WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] Fresh Install, subfolder multisite, infinite redirect loop sub-blog login (57 posts)

  1. Michelpelletier07
    Member
    Posted 1 year ago #

    I had the same problem using a subdirectory. I believe to fix your problem you need to change line 2 from this:
    RewriteBase /
    To this:
    RewriteBase /bbb/

  2. creativepublishing
    Member
    Posted 1 year ago #

    If you are certain you tried the boilerplate code from the beginning of the post EXACTLY as it was listed, then I'm afraid I don't know what to offer as guidance. I see two differences between the boilerplate and what you currently have:

    1. At the very bottom you have a couple lines that are designed to redirect the www to the non-www. That is not in the boilerplate.

    RewriteCond %{HTTP_HOST} ^aaa\-my\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.aaa\-my\.com$
    RewriteRule ^/?$ "http\:\/\/aaa\.my" [R=301,L]

    2. You also have some variable references on these lines:

    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]

    Whereas the boilerplate has:

    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]

    I would try these:
    1. This is just the same boilerplate as above - please try this one more time for me, exactly as this with no additions or deletions.

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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]

    2. This is without the www/non-www code:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    3. This one is the boilerplate minus the variable change.

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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]
    RewriteCond %{HTTP_HOST} ^aaa\-my\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.aaa\-my\.com$
    RewriteRule ^/?$ "http\:\/\/aaa\.my" [R=301,L]

    I should note that I don't like the look of the www/non-www redirect, something deson't look right to me about it. You should goto stackoverflow.com and search for "htaccess www to non-www redirect" there are a wealth of posts on this issue and make sure it is done correctly. Also, in the direction when installing the multi-site, there is a usggestion to take care of that feature in the options BEFORE installing the multisite code. Just something I noticed.

    Additional questions:
    Is your wordpress install at root? or in a sub-folder? i.e. aaa.com/wordpress/ ?

    The problems your describing are exactly the problems I described, so it should be a similar issue. Is this a fresh install, where you can start from scratch? or an existing blog?

  3. artzoon
    Member
    Posted 1 year ago #

    many thanks creativepublishing
    i change in .htaccess file and everything is working fine

    :)

  4. mankam23
    Member
    Posted 1 year ago #

    tried everything that's been said here but still doesn't work for me, 3 days on it . I think I'll just give up and create a secont wp account for my other blog. I've had enough really (lol). I'm using the last version of wp , it's driving me nuts. Would have been best to have all blogs on the same acc but too much headache. looooolll fed up, thanks everyone

  5. ChaosByDesign
    Member
    Posted 1 year ago #

    Wow, with all of this chaos surrounding the multisite you'd think the WP gurus would have stepped in by now and said something.

    Here's my deal - fresh 3.5.1 install, GoDaddy hosting (apache on windows os). I try to add a new site using subdomains. If I'm in the Network Admin dashboard > Sites I can see the new site I just added, HOWEVER it doesn't appear in the My Sites in the top bar, and all I get is a 404 when I try to go to the dashboard. I've tried everything in here with the .htaccess and still no success.

    Since I can't seem to find any information on this ANYWHERE, when you add a new subfoldered site, is wordpress supposed to copy anything into that new folder? Or is the folder even supposed to exist at all?

  6. creativepublishing
    Member
    Posted 1 year ago #

    No, the folder does NOT exist. If the folder exists, if will give you a 404 and not work. The htaccess file checks if the folder or file its looking for exists. Only if it DOESNT exist, does it redirect to the proper file. Subdomain installs also use a different set of htaccess rules I believe so none of these in this thread should work.

  7. ChaosByDesign
    Member
    Posted 1 year ago #

    Ok so I removed the subfolder, went back and set my .htaccess to match what WP has in the codex for 3.5+ multisite subfolder configs, and I'm still getting 404s when I try to hit the new site. Only difference is now I'm seeing the site in My Sites.

  8. ChaosByDesign
    Member
    Posted 1 year ago #

    I'm moving my issue to a new thread since it might not get noticed in the back of this one, also, since the set up is a bit different.

  9. creativepublishing
    Member
    Posted 1 year ago #

    Have to use the boilerplate for subdomain install if thats what your using. Subfolder wont work.

  10. fitbotics
    Member
    Posted 1 year ago #

    Does anybody have a solution for IIS installation where we use web.config file?
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="WordPress Rule 1" stopProcessing="true">
    <match url="^index\.php$" ignoreCase="false" />
    <action type="None" />
    </rule>
    <rule name="WordPress Rule 2" stopProcessing="true">
    <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
    <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
    </rule>
    <rule name="WordPress Rule 3" stopProcessing="true">
    <match url="^" ignoreCase="false" />
    <conditions logicalGrouping="MatchAny">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
    </conditions>
    <action type="None" />
    </rule>
    <rule name="WordPress Rule 4" stopProcessing="true">
    <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
    <action type="Rewrite" url="{R:1}" />
    </rule>
    <rule name="WordPress Rule 5" stopProcessing="true">
    <match url="^([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
    <action type="Rewrite" url="{R:2}" />
    </rule>
    <rule name="WordPress Rule 6" stopProcessing="true">
    <match url="." ignoreCase="false" />
    <action type="Rewrite" url="index.php" />
    </rule>
    </rules>
    </rewrite>
    </system.webServer>
    </configuration>

  11. fitbotics
    Member
    Posted 1 year ago #

    This works in IIS7
    http://pastebin.com/47KRW1RU

  12. jcroucher
    Member
    Posted 1 year ago #

    I am having the same issue with WordPress multi site.

    I have done a fresh install.
    - Unzip
    - Setup WP just with db and admin user
    - Enable multi site
    - Go to the network tab enable subdirectory multi site
    - Copy the code into the config and .htaccess
    - Create a sub site
    - Click to login to the subsite, I get a redirect loop.

    I have deleted and re-done the install 3 times, with the same error.
    I have tested all the config options throughout the pages of threads on this site all with the same issue.

    define('WP_ALLOW_MULTISITE', true);
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    define('DOMAIN_CURRENT_SITE', 'wp.example.com.au');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);

    It seems to be redirecting in code as I can remove the htaccess and I get the same redirect error.
    I have also tried enabling debugging. There are no errors in the log.

    I have tried clearing the browser and 3 different computers.

    Any ideas?

  13. creativepublishing
    Member
    Posted 1 year ago #

    Redirecting in code?

    Hrmmmphff!

    Must be a header() location call. I haven't dug through the code for WordPress much as I was just fiddling with it when I started this thread.

    I am very surprised that it redirects without the .htaccess file. Where is it redirecting to? Get a plugin for your browser and check out the headers of the server response. Something like Live Headers.

    That might help you debug the issue. Otherwise I have no idea without some more info :(

  14. jcroucher
    Member
    Posted 1 year ago #

    It spews out about 10 of these then stops.

    [16:53:43.263] GET http://wp.example.com.au/site1/wp-admin/ [HTTP/1.1 302 Found 190ms]

    Request URL: http://wp.example.com.au/site1/wp-admin/
    Request Method: GET
    Status Code:
        HTTP/1.1 302 Found
        Request Headers
        16:53:43.000
    User-Agent:Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0Host:wp.example.com.auConnection:keep-aliveAccept-Language:en-US,en;q=0.5Accept-Encoding:gzip, deflateAccept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    
    Response Headers
    Δ190ms
    X-Pingback:http://wp.example.com.au/site1/xmlrpc.phpVary:Accept-EncodingServer:ApachePragma:no-cacheLocation:http://wp.example.com.au/site1/wp-admin/Keep-Alive:timeout=15, max=84Expires:Wed, 11 Jan 1984 05:00:00 GMTDate:Wed, 20 Feb 2013 06:23:48 GMTContent-Type:text/html; charset=UTF-8Content-Length:20Content-Encoding:gzipConnection:Keep-AliveCache-Control:no-cache, must-revalidate, max-age=0
  15. jcroucher
    Member
    Posted 1 year ago #

    I found where the redirect is happening.

    In wp-includes/canonical.php:525

    if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) {
    wp_redirect( admin_url() );
    exit;
    }

    This is the point at which it keeps looping back to the admin page.

    If I comment out this line it no longer loops, but it loads a wordpress "Page Not Found" page. This is coming from the sub site.
    It should be loading the admin system.

    var_dump of $_SERVER['REQUEST_URI'] - string(16) "/site1/wp-admin/"

    Also if I go to

    http://wp.example.com.au/site1/wp-admin/post-new.php

    It loads the "Page Not Found" page again. Even with the redirect line uncommented. It seems to only get into the redirect loop when its just http://wp.example.com.au/site1/wp-admin/

    Edit: I am running WP 3.5.1

  16. jcroucher
    Member
    Posted 1 year ago #

    Fixed. The .htaccess was not running so it seems that it does some internal redirect.

    I found there was a "AllowOverride None" in the vhost config. Once I changed it to "AllowOverride All", it allowed the .htaccess to run, which has then fixed the redirect loop.

  17. johncamelo
    Member
    Posted 1 year ago #

    Hey creativepublishing thanks it worked your solution, thank you...

  18. Smittie
    Member
    Posted 1 year ago #

    OK. I've read through this thread multiple times. Tried and retried the suggested solutions. I get nothing but redirect authorization loop. So, here are my details.

    WordPress is installed at: ~/htmlRoot/wordpress/
    Current blog is installed at: ~/htmlRoot/blog/

    In non-multisite mode, this setup works fine. However, when I follow the instructions (here) and then try to log in, I get this in the browser address bar:

    http://smittie.com/wordpress/wp-login.php?redirect_to=http%3A%2F%2Fsmittie.com%2Fwordpress%2Fwp-admin%2F&reauth=1

    My .htaccess file:

    RewriteEngine On
    RewriteBase /blog/
    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]

    Obviously am I missing something. Can I buy a clue?

    -- Smittie

  19. softmixt
    Member
    Posted 1 year ago #

    Just add.

    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIE_DOMAIN', '');
    define('COOKIEPATH', '');
    define('SITECOOKIEPATH', '');

    to wp-config.php file.

  20. gouldgit
    Member
    Posted 11 months ago #

    Perfect!! Thank you-! I had a bunch of other symptoms as well, and have been chasing down each one. This appears to have fixed them all.

  21. csmith79
    Member
    Posted 10 months ago #

    I used this boilerplate .htaccess code:

    I am using the same .htaccess code and was able to get it working briefly yesterday, however I had to fix a redirect issue in apache and when I did I can no longer get the subsites to work. I am able to create new subsites and the dashboard work correctly, however when you click on the login or register links a page can not be found message is issued.

    Here is the subsite http://teach.wpcc.edu/trying/

    Here is what I get when trying to logout/login from the subsite http://teach.wpcc.edu/trying/wp-login.php?action=logout&_wpnonce=f38c52190c

    Any ideas on how to fix this?

  22. zanzaboonda
    Member
    Posted 10 months ago #

    @creativepublishing
    Thank you. Thank you. Thank you. Thank you. Thank you!

  23. srumery
    Member
    Posted 10 months ago #

    @softmixt - Thank you! Thank you! Thank you!

    I will say that the following combination is really complicated:
    WordPress Multisite with subdomains using WAMP locally

    Custom edits for:

    • wp-config in WordPress
    • hosts file on Windows 7
    • httpd.conf in the WAMP Apache config
    • httpd-vhosts.conf in the WAMP Apache config
    • .htacess in the virtual host setup

    After all that... turns out your cookie code was the final piece I needed to get everything working the way I needed it to.

    Cheers!

  24. photocoen
    Member
    Posted 9 months ago #

    Recently I started to have redirect issues on our subfolder hosted site.

    http://www.landcruisingadventure.com

    So I used this boilerplate on the .htacces file in the subfolder:

    # BEGIN WordPress
    # END WordPress
    
    RewriteEngine On RewriteBase /
    RewriteRule ^index\.php$ - [L] # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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]

    From there everything on went smooth. Until I needed to sign in again, and I can't acces my login page.

    http://www.landcruisingadventure.com/wp-login.php

    It sends my to:

    http://www.landcruisingadventure.com/wplca/wp-login.php

    but instead of showing the login page, it shows a 404 content?

    When I try to go to:

    http://www.landcruisingadventure.com/wp-admin

    it sends me to:

    http://www.landcruisingadventure.com/wplca/wp-login.php?redirect_to=http%3A%2F%2Fwww.landcruisingadventure.com%2Fwplca%2Fwp-admin%2F&reauth=1

    How do I get to my login page?

    Adventurous greetings,
    Coen

  25. Los3233
    Member
    Posted 9 months ago #

    @dains which lines did you carefully remove? I've tried this fix a few times and I still can't get the dashboards for my subfolder sites to load.

  26. trade-gate
    Member
    Posted 8 months ago #

    Hello I have a redirection loop problem with the page I am trying to make: http://www.trade-gate.net. Unfortuantely I don't know much about coding. The problem started when I renamed some of the pages that are under my website. I renamed some pages several times I am afraid - not knowing that this might be a problem. Now I understand that all those records were kept somewhere in the memory of wordpress and authomatically wordpress keeps directing to each other.

    I don't know how I will solve this. If I touch the htaccess file, I am afraid that everything will clash. I could not even understand whether the above fix that @creativepublishing proposed would fit me or not.

    I think there should be a simple solution to this because it can be encountered so easily while renaming pages.

    For example, one of the pages that have this problem is the following: http://www.trade-gate.net/eurostrong-televizyon-koltuklari/

    If you can advise a solution for me, I would greatly appreciate.

    Thank you.

  27. Guys, this post is RESOLVED.

    Make your own :) It's okay.

Topic Closed

This topic has been closed to new replies.

About this Topic