Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Apache Optimizations: Activating Enforce Canonical URLs + Multisite Domain Mapping causes sub sites to break #798

Closed
renzms opened this issue Jul 10, 2016 · 8 comments

Comments

@renzms
Copy link

@renzms renzms commented Jul 10, 2016

Overview

Using the new Apache Optimizations: feature Enforce Canonical URLs in a Multisite installation with Domain Mapping is causing a bug for Sub Sites in the multisite network. Images and theme files are malfunctioning while Enforce Canonical URLs is activated.

Steps to Reproduce

  • Setup a Sub Site on a clean Multisite Network
  • Upgrade to/install Comet Cache Pro v160706 / v160709 for Multisite
  • Upload media files
  • Configure Multisite Domain Mapping
  • Activate Enforce Canonical URLs under Dashboard → Comet Cache Pro → Plugin Options → Apache Optimisations

Expected Behavior

Sub Site should load and function normally like so:

screen shot 2016-07-11 at 1 11 25 am

Observed Behavior

Sub Site images are missing/broken, and theme files are malfunctioning.

See image below:
screen shot 2016-07-11 at 1 12 07 am

Temporary Fix

Do not use Enforce Canonical URLs in the mean time


Referencing internal ticket: https://websharks.zendesk.com/agent/tickets/13367

@raamdev
Copy link
Contributor

@raamdev raamdev commented Jul 11, 2016

@renzms writes...

Configure Multisite Domain Mapping

Could you elaborate a little on how you configured Multisite Domain Mapping?

I'm not able to reproduce the issue you're describing here. I have multisite + domain mapping + Enforce Canonical URLs and the (domain mapped) sub-site works just fine.

Loading

@renzms
Copy link
Author

@renzms renzms commented Jul 12, 2016

@raamdev writes

I'm not able to reproduce the issue you're describing here. I have multisite + domain mapping + Enforce Canonical URLs and the (domain mapped) sub-site works just fine.

Fixed where the Domain Mapping plugin was and put it in the MU Folder. You are correct that it works if setup correctly.

I tried this in another way, using subdirectory site instead of subdomain, and that is where a problem seem to occur even without the Domain Mapping plugin.

Could you please try also with a subdirectory site + Enforce Canonical URLs?

Loading

@raamdev
Copy link
Contributor

@raamdev raamdev commented Jul 16, 2016

Bug Confirmed

Steps to reproduce

  • Install WordPress in a sub-directory, e.g., /wordpress/
  • Set up WP Multisite w/ Sub-Directories
  • Create Child Site, e.g., /wordpress/child1/
  • Install and activate Comet Cache Pro v160709
  • Enable Comet Cache Pro with Apache Optimizations → Enforce Canonical URLs enabled
  • Visit Child Site (e.g., /wordpress/child1/)

Expected Behavior

Child site should load with no broken images / CSS.

Observed Behavior

Child site loads with broken CSS/images:

2016-07-16_12-40-09


.htaccess contents (with Enforce Canonical URLs enabled):

# BEGIN Comet Cache WmVuQ2FjaGU (the WmVuQ2FjaGU marker is required for Comet Cache; do not remove)

# Force a trailing slash on all virtual requests (except WP admin area).
<IfModule rewrite_module>
  RewriteEngine On
  RewriteBase /wordpress/

  # If not a real file or directory.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  # Not a part of the WP admin area.
  RewriteCond %{REQUEST_URI} !(?:^|/)wp\-admin(?:/|$)

  # If there is no trailing slash.
  RewriteCond %{REQUEST_URI} !/$

  # Force a trailing slash on all virtual requests.
  RewriteRule ^(.*)$ /$1/ [QSA,L,R=301]
</IfModule>

# END Comet Cache WmVuQ2FjaGU

# BEGIN WordPress

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

# END WordPress

Loading

@raamdev
Copy link
Contributor

@raamdev raamdev commented Jul 22, 2016

@jaswsinc The fix for the above is not obvious to me, is it to you?

Loading

@jaswrks
Copy link

@jaswrks jaswrks commented Jul 22, 2016

Try removing the leading / in this line. Looks like Apache could be ignoring RewriteBase due to that leading slash. This should fix that up.

RewriteRule ^(.*)$ $1/ [QSA,L,R=301]

Loading

@raamdev raamdev self-assigned this Aug 3, 2016
@raamdev raamdev removed this from the Next Release milestone Sep 6, 2016
@raamdev raamdev added this to the Future Release milestone Sep 6, 2016
@raamdev raamdev added this to the Future Release milestone Sep 6, 2016
@raamdev raamdev removed this from the Next Release milestone Sep 6, 2016
@raamdev raamdev removed their assignment Oct 11, 2016
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Nov 8, 2016
…oken by Apache Optimizations via `.htaccess` in some scenarios. Fixed in this release. See also [issue #798](wpsharks/comet-cache#798) if you'd like additional details.
@jaswrks
Copy link

@jaswrks jaswrks commented Nov 8, 2016

Next Release Changelog:

  • Bug Fix: Multisite installations inside a sub-directory were broken by Apache Optimizations via .htaccess in some scenarios. Fixed in this release. See also issue #798 if you'd like additional details.

Loading

@renzms
Copy link
Author

@renzms renzms commented Nov 17, 2016

@raamdev

Confirmed Working 👍

Steps taken

  • Installed WordPress in a sub-directory
  • Set up WP Multisite w/ Sub-Directories
  • Created Child Site
  • Installed and activated Comet Cache v161116-RC
  • Enabled Comet Cache Pro with Apache Optimizations → Enforce Canonical URLs enabled
  • Visit Child Site

screen shot 2016-11-17 at 9 35 35 pm

Loading

@raamdev
Copy link
Contributor

@raamdev raamdev commented Nov 19, 2016

Comet Cache v161119 has been released and includes changes from this GitHub Issue. See the v161119 announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#798).

Loading

@raamdev raamdev closed this Nov 19, 2016
@wpsharks wpsharks locked and limited conversation to collaborators Nov 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants