Plugin Conflict - Site Categories & Domain Mapping

Like many people, I've been struggling with Site Categories. When I turned on Pretty URL, I receive 404 Error response when opening Category pages. When I turn off Pretty URL, pagination simply refreshes the page and doesn't load the next sites.

I changed themes, enabled DEBUG, and turned off every plugin ... or so I thought I had. Then, at the last minute, I realized, I hadn't tested it against Domain Mapping. Sure enough, when I turned off Domain Mapping, the Site Categories plugin worked as expected.

I have attached images with my settings for each plugin. They look very small when in preview mode. To view the larger image, right click on it and select "Open in a new window". Click on the image to enlarged it.

Could someone please help find a fix for this conflict soon, and bring the developers in on this if needed?

Thanks,
Chris

  • James Morris
    • WordPress Enthusiast

    Hello Chris,

    I hope you are well today.

    Thank you for providing the above information. I have a few more questions to see if we can get to the root of the problem:

    * Do you have your network setup to use subdomains or subfolders?
    * Have you tried refreshing your permalinks after enabling these plugins?

    If you don't mind, I'd like to take a look at your site and get a better idea of the configuration and symptoms you're experiencing. Would you mind enabling Support Staff Login so I can take a look?

    You can learn how to grant WPMU DEV Support Access at the following link:

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Please reply back here once you've enabled access so I will be notified.

    Best regards,

    James Morris

  • Chris
    • The Bug Hunter

    Hi James (@jrmorris77) ,

    Thanks for your quick response. Here are the answers to your questions:

    * Do you have your network setup to use subdomains or subfolders? - SUBDOMAINS
    * Have you tried refreshing your permalinks after enabling these plugins? - YES

    I have enabled support.

    Thanks,
    Chris

  • James Morris
    • WordPress Enthusiast

    Hello Chris,

    I hope you are well today.

    I've logged into your site and ran several tests. I am seeing the symptoms you are reporting. However, when I installed Domain Mapping and Site Categories on my own server and mirrored your settings there, I was unable to reproduce this issue. This leads me to believe there might be some issue in your .htaccess file that could be causing this. Would you please grant me access to your server so I can look into this further?

    Please visit the Contact page and complete the form with the following information:

    Select "I have a different question" from the drop-down box.

    Subject: "Attn: James Morris"

    In the Message box, please provide the following:

    - Admin login:
    Admin username
    Admin password
    Login url

    - FTP credentials
    host
    username
    password
    (and port if required)

    - link back to this thread for reference
    - any other relevant urls

    Best regards,

    James Morris

  • Chris
    • The Bug Hunter

    Hi James,

    Thanks for having a look. I am unable to provide server access. I will paste the .htaccess file here though. Please let me know if you need additional files.

    Chris

    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]
    
    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>
    
    deny from 94.23.12.178
    deny from 193.189.117.243
    
    # Wordfence WAF
    <Files ".user.ini">
    <IfModule mod_authz_core.c>
    	Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
    	Order deny,allow
    	Deny from all
    </IfModule>
    </Files>
    
    # END Wordfence WAF
  • James Morris
    • WordPress Enthusiast

    Hello Chris,

    Unfortunately, that's not the problem.

    However, I did find the source of the problem. On my test site, I did not force https as I do not have an SSL certificate installed. I just temporarily disabled "Would you like to force http/https in front-end pages:" on your site and the rewrites worked correctly. This does appear to be a bug and I will report this to the developer immediately.

    Please keep in mind that bug reports do take a bit longer to be addressed than support tickets, but our team will look into this and address it as soon as possible.

    Thank you for your patience while we work through this.

    Best regards,

    James Morris

  • James Morris
    • WordPress Enthusiast

    Chris,

    This is an interesting idea, but one I have not tested before.

    The following link give some example code of how to disable SSL on a specific folder. Since your slug for the categories is directory/ you could treat that as your folder and modify the .htaccess using this example: http://stackoverflow.com/questions/17539114/remove-ssl-integration-from-a-specific-folder-using-htaccess

    Please let us know if this works for the benefit of anyone else who may run into this issue.

    Best regards,

    James Morris

  • Chris
    • The Bug Hunter

    Update - The link above did work. I forgot to change the settings in Domain Mapping to 'No' so it doesn't force https on all pages. I also left the setting for "login/admin area https" set to 'Yes'. I then added the following code near the top of the htaccess file:

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !^/directory
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    I added this just below the opening code:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    The /directory/ and its children are the only pages that don't load with https. Pagination works now too, and it loads with Pretty URLs for Categories.

    James Morris

  • Chris
    • The Bug Hunter

    Update - For my live site, I needed to other piece of code from the link James Morris provided above in order to make it work.

    RewriteEngine On
    RewriteCond %{HTTPS} on
    RewriteCond %{REQUEST_URI} ^/directory
    RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    I want to add another line to remove SSL from a second page/folder. I've had some trouble. I've ended up with the following code. Could someone tell me if this is the right way to have done it?

    RewriteEngine On
    RewriteCond %{HTTPS} on
    RewriteCond %{REQUEST_URI} ^/blogs [OR]
    RewriteCond %{REQUEST_URI} ^/directory
    RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    Is this correct? And/or, can it be done more efficiently?

    Thanks,
    Chris

  • James Morris
    • WordPress Enthusiast

    Hello Chris,

    Your .htaccess rules look good. If it's working, then it's a temporary solution, at least. I've notified the developer that you're using this workaround, but still need a permanent solution to this issue, though. If you're running into this problem, then other are likely to as well.

    Best regards,

    James Morris

  • Chris
    • The Bug Hunter

    James Morris

    The results on both the live and demo sites are inconsistent. They start out fine, then a few hours later, the content only shows in either all unsecured (http) or secured (https), depending upon the code I've tried. I'm not sure what is breaking it.

    When I update the htaccess file, making any type of change ... then, reversing the changes to the original and it works again.

    Any thoughts? Maybe a caching plugin? Or, could it be server related?
    SERVER_PORT 80 // SERVER_PROTOCOLHTTP/1.1?

    Chris

  • Chris
    • The Bug Hunter

    James Morris

    I tried disabling caching and it still persisted. I have an idea for a temporary fix that looks like it could work. Site Categories appears to work correctly even when Domain Mapping is forcing https, when the following two are true:

    1. Pretty URL is turned off, and
    2. when viewing a category (with pagination), manually change "next link" in the browser's address bar to the following:

    FROM > /page-slug/?category=category_name&start_at=2
    TO > /page-slug/2/?category=category_name

    It looks like the magic is happening in plugins/site-categories/site-categories.php. However, I am not a programmer, so I'm not sure how to go about modifying the code to move '2' from a parameter to a /folder/ in the URL.

    Can you please have a look?

    I have enabled support access in my demo site. I'll paste the page-slugs with category paremeters below for a category that has pagination.

    /directory/?category=commercial-fiction

    Page 1 = Test Site 6
    Page 2 = Test Site

    What happens when clicking Next:
    /directory/?category=commercial-fiction&start_at=2 (doesn't work, just refreshes)

    Modify URL
    /directory/2/?category=commercial-fiction --> Goes to 2nd page of Category

    Thanks,
    Chris

  • James Morris
    • WordPress Enthusiast

    Hello Chris,

    I hope you are well today.

    I've pinged our SLS staff to see if we can come up with a solution to the problems you are having. An update will be posted here as soon as more information is available. Thank you for your patience while we work through these issues.

    Best regards,

    James Morris

  • James Morris
    • WordPress Enthusiast

    Hello Chris,

    I apologize for the delay in response.

    We've had several people digging into this and doing some testing, but none of us have been able to reproduce the exact issue you're having. Since we don't have access to your server to see your configuration in better detail, we're stabbing in the dark as it were.

    The general consensus is that there may be an issue with your .htaccess. For the sake of testing purposes, could you backup your current .htaccess as backup.htaccess, create a new .htaccess file and insert this default multisite rule set in the file?

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    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]
    </IfModule>
    
    # END WordPress

    If this does not work, could you re-enable Support Staff Login and reply back here so we will be notified?

    Best regards,

    James Morris

  • Chris
    • The Bug Hunter

    Hi James,

    I replaced the .htaccess file with the code above, but it didn't make any difference. I had cleared the cache and re-saved permalinks before testing. Then, I tried Pretty URL, but that still returned a 404 error.

    I'm certain that one other member was experiencing the same issues in the following thread:

    https://premium.wpmudev.org/forums/topic/site-categories-plugin-issue-with-next-page-display-function

    You can see he has SSL. Are you able to check whether or not he's using Domain Mapping?

    I've re-enabled Support Staff Login. I'll leave your code in the .htaccess file for now. Please let me know what information I can provide regarding my server's configuration.

    Thanks,
    Chris

  • Chris
    • The Bug Hunter

    Hi James Morris

    I created a fresh multisite install to test things from a clean slate here. I only added three plugins:

    - WPMUDEV Dashboard
    - Domain Mapping
    - Site Categories

    To my surprise, it worked correctly (for 5 minutes!). I was a bit perplexed, so I compared the settings of my development site and today's install. I went through the settings of Domain Mapping. They were fine. However, when I went through Site Categories, I saw I had left "Open links in new windows" off. I turned it on, and saved. Then, it broke again.

    I can't imagine that this option broke the plugin. Maybe the mere act of re-saving broke it. I turned off this option ... it was still broken. I turned off Domain Mapping and loaded the HTTP version of the plugin ... still broken. I re-saved permalinks ... still broken. It appears that this has nothing to do with Domain Mapping or SSL.

    I'm completely confounded. I will turn on Support Agent Login for this new site and send you the login details for cPanel.

    Thanks,
    Chris

  • James Morris
    • WordPress Enthusiast

    Hello Chris,

    Excellent troubleshooting! This is very useful information!

    Yes, if you could grant us access to this new test site and its server that would be very helpful in finding a solution. Please visit the Contact page and complete the form with the following information:

    Select "I have a different question" from the drop-down box.

    Subject: "Attn: James Morris"

    In the Message box, please provide the following:

    - Admin login:
    Admin username
    Admin password
    Login url

    - Hosting Control Panel Login
    Admin username
    Admin password
    Login url

    - FTP credentials
    host
    username
    password
    (and port if required)

    - link back to this thread for reference
    - any other relevant urls

    Best regards,

    James Morris

  • James Morris
    • WordPress Enthusiast

    Hello Chris,

    I've spoken with the developers about this and they have informed me that it is on the high priority list of bugs to be addressed as soon as possible. I've been following up with them frequently to ensure that this is addressed. Since this is a confirmed bug dealing with the option in Site Categories, no further information is needed at this time. Someone will reply back here if that changes. Also, an update will be published as soon as possible.

    Best regards,

    James Morris

  • Chris
    • The Bug Hunter

    James Morris

    Sorry to be a bother, but is it possible to get an ETA? I have people over here breathing down my neck, as well as a group of freelancers waiting for this part of the site to go live so they can get to work. So, I'm feeling the pressure.

    I would greatly appreciate any time estimate. Also, if it's more than a week, is it possible to get some sort of work around until the plugin is updated?

    Thanks,
    Chris

  • James Morris
    • WordPress Enthusiast

    Hello Chris,

    I sincerely apologize for the delay and the problems it has caused you.

    Unfortunately, I'm not allowed to give ETAs on when bugs will be addressed as complications almost always arise. However, I have updated the task in our bug tracker and contacted our SLS team to ask if there might be a workaround we can put together for you.

    Best regards,

    James Morris

  • Chris
    • The Bug Hunter

    Hi James Morris

    Thank you for the wonderful Christmas present :slight_smile: And, a big thank you to the developers you worked with too! I appreciate you making it a priority. I'll test it out after Christmas and post back here to let you know how it goes.

    Have a nice holiday,
    Chris

  • Chris
    • The Bug Hunter

    Hi James Morris

    Did you test this with SSL? I've tested it on two site - one with SSL and the other without SSL. It still does not work correctly on the SSL site. When I turn on Domain Mapping (w/ forced SSL), the Site Categories plugin breaks.

    Note - I've deactivated all plugins and reverted to the WP 2017 theme to test. Please note that this multisite is using Multi-DB. Will that affect how this plugin works?

    Thanks
    Chris

  • Chris
    • The Bug Hunter

    Hi James Morris

    Here's a quick update to my last message - I'm seeing a few strange things here. I will create a spreadsheet tomorrow and track changes in the plugin settings to try to diagnose as much as I can from here. I'll re-post once I've finished. However, I'd still like to know if you had tested this using SSL.

    Thanks,
    Chris

  • Chris
    • The Bug Hunter

    James Morris - Thank you for all of your help. Unfortunately, the plugin update was still not working for me. I tested it against several scenarios which I mapped in Excel. There is definitely a conflict with Domain Mapping, when forcing SSL on all front-end pages.

    I finally found a solution with the following:

    * Domain Mapping - Would you like to force http/https in front-end pages? No
    * .htaccess modification (link - see below)

    <IfModule mod_rewrite.c>
    RewriteEngine On
    # Go to https if not on directory (i.e. Site Categories page)
    RewriteCond %{SERVER_PORT} =80
    RewriteCond %{THE_REQUEST} !/directory* [NC]
    RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R,L]
    
    # Go to http if you are on directory
    RewriteCond %{SERVER_PORT} !=80
    RewriteCond %{THE_REQUEST} /directory* [NC]
    RewriteRule ^(.*)$ http://www.mywebsite.com/$1 [R,L]
    </IfModule>

    Thanks,
    Chris

  • Chris
    • The Bug Hunter

    Update to code:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    # Go to https if not on directory (i.e. Site Categories page)
    RewriteCond %{SERVER_PORT} =80
    RewriteCond %{THE_REQUEST} !/directory* [NC]
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
    
    # Go to http if you are on directory
    RewriteCond %{SERVER_PORT} !=80
    RewriteCond %{THE_REQUEST} /directory* [NC]
    RewriteRule ^(.*)$ http://www.mywebsite.com/$1 [R,L]
    </IfModule>
  • James Morris
    • WordPress Enthusiast

    Hello Chris,

    I apologize for the delay in replying.

    Thank you for providing the solution you have found. I'm going to ping the developers and let them know what they found so they can further dig into this issue and find a permanent solution.

    Happy New Year! :slight_smile:

    Best regards,

    James Morris

  • Chris
    • The Bug Hunter

    I have one more update to the code above.

    Problem - Mapped Domains were being redirected to HTTPS. This is a problem if an SSL cert doesn't exist for user-mapped domains

    <IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Go to https if not on directory
    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP_HOST} ^(.*)primarydomain(.*)$ [NC]
    RewriteCond %{THE_REQUEST} !/directory* [NC]
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
    
    # Go to http if you are on directory
    RewriteCond %{HTTPS} on
    RewriteCond %{THE_REQUEST} /directory* [NC]
    RewriteRule ^(.*)$ http://primarydomain.com/$1 [R,L]
    
    </IfModule>
    • James Morris
      • WordPress Enthusiast

      Hello Claudio,

      I'm sorry to hear you are experiencing this problem. In order to assist you most efficiently with your particular situation, would you please go ahead and start your own thread with a link back to this thread for reference?

      This will enable us to request access to your site and provide more efficient support, while also reducing the notifications being sent to the original poster of this ticket. :wink:

      You can start your own thread at the following link: https://premium.wpmudev.org/forums/#question

      Best regards,

      James Morris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.