WordPress.org

Ready to get started?Download WordPress

Forums

Redirecting to index when using sub-directory (12 posts)

  1. dustindk
    Member
    Posted 3 years ago #

    I am trying to install multisite on a WP installation that is older than 30 days. I used this tutorial to force WP to let me use sub-directories in stead of sub-domains by changing

    define( 'SUBDOMAIN_INSTALL', true );

    to

    define( 'SUBDOMAIN_INSTALL', false );

    When I make this change, every post/page/archive on my main site redirects back to the main site index.

    Any ideas why this is happening?

  2. joshmac
    Member
    Posted 3 years ago #

    So, you follow the whole tutorial by changing the blog slug and editing your .htaccess file? Also, try updating your permalinks structure by changing it to another structure, click save, then change it back and click save.

  3. dustindk
    Member
    Posted 3 years ago #

    Yes, I edited my .htaccess file and installed the Remove Blog Slug plugin. I also tried switching the permalink structure a couple times. No matter what permalink structure I have it on as long as I change 'true' to 'false' in the above code everything redirects back to the main index. I can simply change 'false' back to 'true' and everything works fine again.

  4. joshmac
    Member
    Posted 3 years ago #

    Did you update the network under Site-Admin > Update. If so, and that still didn't work, I would make sure that you have a full backup of your database, set this in your wp-config.php file:

    define('WP_ALLOW_MULTISITE', true);

    Then go to Site-Admin > Update and update the network and see if that changes anything.

  5. The htaccess rules are different for each setup. If you made it a subdomain install first, go back to the Network menu item and snag the (now correct) rewrite rules for subfolders.

  6. dustindk
    Member
    Posted 3 years ago #

    I have found that if I change the permalink to Default every works okay but when I change it back to custom /%postname/ everything redirects again.

    I also noticed in permalink page it still shows a /blog/ even though I have the Blog Slug plugin enabled. The actualy links do not contain the /blog/ though.

    http://screencast.com/t/YTAyMDk5Y

    I tried copying the .htaccess rules again after changing 'true' to 'false' in wp-config but I get the same results. I will try doing the network upgrade and see if that helps.

  7. Lee
    Member
    Posted 3 years ago #

    Hello Dustin, I'll reply here as well as at JournalXtra for the benefit of others.

    The /blog/ slug will still show in the backend. That's normal. It does this with my test blogs and with those I install for others.

    Having provided a few suggestions at JournalXtra, I'm now stumped as to what to suggest. It's good we've established it's a permalink issue. But knowing how to fix it is something else. I've had a few problems with WP MS that have required me to re-install to get it functioning as it should (unrelated to forcing sub-directories). Those problems were created by plugins. Maybe that's what you'll have to do. We've tried disabling and re-enabling plugins, we've checked the redirects created by the Redirection plugin (removed root / redirects) and you've used an .htaccess file with only the essential rules.

    Maybe the .htaccess WordPress re-write rules are wrong. Here's a copy of the .htaccess rules used on one of my subdirectory using WP MS sites:

    DirectoryIndex index.php
    
    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]

    Try the above .htaccess rules and see what happens. It's possible there's a mistake in the rules you are using.

  8. dustindk
    Member
    Posted 3 years ago #

    I tried updating the network but am getting an error message:

    Warning! Problem updating http://MLTnews.com. Your server may not be able to connect to sites running on it. Error message: connect() timed out!

    I also tried the new .htaccess rules posted by diondeville but the result is the same. One thing I did notice is that when I change the permalink to Default and then back to /%postname%/ all the links from the homepage are actually /%postname%/ and redirect back tot he homepage but if I go to the default url for a post (/?=postid) I can still access the post without it redirecting.

  9. Better contact your webhost support for the first error,

    the other one means mod_rewrite isn't working *at all* so you'd better ask them about that too.

  10. dustindk
    Member
    Posted 3 years ago #

    Am I supposed to include the <IfModule mod_rewrite.c> and </IfModule> in the .htaccess code? On the Create a Network of WordPress Sites page it does not include these but in the tutorial on journalxtra.com they are included.

  11. dustindk
    Member
    Posted 3 years ago #

    Something else I noticed: I have a .htacess.cpmove file as well and the contents are:

    RedirectMatch .* /cgi-sys/suspendedpage.cgi

    Would this have anything to do with the problem? Just a thought.

  12. dustindk
    Member
    Posted 3 years ago #

    Here's another thought. I actually have another separate install of WP in a sub-directory on the site. Would that have anything to do with the issue?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.