It sounds like the issue you’re experiencing is related to WP-Optimize caching configuration on your server, where multiple domains are conflicting with each other. The problem you’re describing, where pages from one website redirect to another (e.g., /service/
from example.com
goes to example2.com
), often occurs due to misconfigured caching or a conflict between server and plugin settings.
Here’s how you can troubleshoot and resolve the issue:
1. Check WP-Optimize Cache Settings
Make sure that the cache settings are not being shared across your multiple websites. Since WP-Optimize handles caching, it’s important to ensure that each website has its own dedicated cache directory. You can verify this by following these steps:
- Go to WP Admin Panel → WP-Optimize → Cache.
- Ensure that caching is enabled separately for each domain.
- If necessary, you can exclude URLs from being cached to prevent this redirection issue. For example, if
/service/
should not be cached, you can exclude it in the cache settings under Advanced settings by adding the URL to the exclusion list.
2. Use Separate Cache Files for Each Domain
If both sites are hosted on the same server, it’s important to ensure that WP-Optimize is not inadvertently sharing cache files between domains. You can define separate cache directories by adding this code to your wp-config.php
file for each website:
define('WPO_CACHE_CUSTOM_EXT_DIR', ABSPATH . '/wp-content/cache/extensions/example.com/');
3. Purge Cache After Configuration
After making changes, purge the cache for each website to ensure that the issue does not persist due to old cached files. You can do this by navigating to WP Admin Panel → WP-Optimize → Cache and clicking on Purge All Cache.4. Check for Conflicts with Server-Level Caching (e.g., Redis)
Since you’re using Redis, which is a server-level caching mechanism, ensure that WP-Optimize’s caching doesn’t conflict with Redis. If both are enabled, they might overlap, leading to issues like cross-domain redirects. Consider turning off page caching in WP-Optimize if Redis is handling caching for your sites.5. Disable WP-Optimize Cache (if needed)
If the issue continues, try disabling page caching in WP-Optimize to test if Redis alone can handle the caching. Sometimes, two caching systems can cause problems when running simultaneously.
If you follow these steps and continue to experience issues, feel free to provide more details, and we can further investigate.