You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Cloud Platform上OpenLiteSpeed部署的WordPress站点HTTP与HTTPS内容不一致及重写规则异常问题求助

Troubleshooting & Fixes for Your OpenLiteSpeed + WordPress Setup

Let’s work through your issues step by step—we’ll fix the WebAdmin rewrite rule save error, resolve the HTTP/HTTPS content mismatch, and get your domain redirecting properly.

1. Fix the WebAdmin Rewrite Rule Save 404 Error

First, let’s unblock the WebAdmin console since it’s preventing you from setting up redirects directly. Try these common fixes:

  • Check Firewall & WebAdmin Listener: Confirm the OpenLiteSpeed WebAdmin port (default 7080) is allowed in your GCP firewall rules. Also, log into the WebAdmin (if you can access it) and go to Server Configuration > Listeners to verify the WebAdmin listener is active with the correct IP/port.
  • Reset WebAdmin Credentials: Permission glitches can cause this. Run this command to reset your WebAdmin password, then log back in:
    /usr/local/lsws/admin/misc/admpass.sh
    
  • Fix Directory Permissions: Ensure the WebAdmin files have the right ownership:
    chown -R lsadm:lsadm /usr/local/lsws/admin/
    

After trying these, you should be able to save rewrite rules without hitting a 404.

2. Resolve Inconsistent HTTP/HTTPS Content

The content mismatch almost always happens because WordPress isn’t using HTTPS as its canonical URL. Here’s how to fix it:

  • Update WordPress Site URLs: Log into your WordPress admin (use HTTPS if possible, or phpMyAdmin if HTTPS admin is broken). Go to Settings > General and set both WordPress Address (URL) and Site Address (URL) to https://bonheurgifts.in/.
  • Flush Caching Layers: Since you’re using Redis and Memcached, old HTTP-based content might be stuck in cache. Run these commands to clear them:
    # Flush Redis cache
    redis-cli FLUSHALL
    # Restart Memcached to clear its cache
    sudo systemctl restart memcached
    
  • Update Existing Content Links: If old HTTP links are still in your posts/pages, use WP CLI to replace them (run this from your WordPress root directory, e.g., /var/www/html):
    cd /var/www/html
    wp search-replace 'http://bonheurgifts.in' 'https://bonheurgifts.in' --skip-columns=guid
    
    If you don’t have WP CLI installed, use phpMyAdmin to run this SQL query:
    UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://bonheurgifts.in', 'https://bonheurgifts.in');
    

3. Set Up Automatic Redirects (HTTP → HTTPS)

Now that WebAdmin is working, set up rewrite rules to redirect all traffic to HTTPS:

  1. Log into OpenLiteSpeed WebAdmin (port 7080).
  2. Go to Virtual Hosts > Your WordPress VHost > Rewrite.
  3. Toggle Rewrite to Yes, then paste these rules into the Rewrite Rules box:
    RewriteEngine On
    # Redirect all HTTP traffic to HTTPS
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
  4. Save the settings, then click Graceful Restart in the top-right corner of the WebAdmin to apply changes.
  5. Add redundancy to your WordPress .htaccess file (in your WP root directory):
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    # Keep WordPress default rewrite rules below
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    

4. Verify the Fixes

  • Open an incognito window and visit http://bonheurgifts.in—it should automatically redirect to https://bonheurgifts.in.
  • Check that both HTTP and HTTPS versions now show identical content.
  • Test saving a rewrite rule in WebAdmin again to confirm the 404 error is resolved.

内容的提问来源于stack exchange,提问作者Suyash Nalawade

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 05:37:38