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

Hetzner虚拟服务器(Plesk管理)WordPress固定链接404问题求助

I’ve helped several clients troubleshoot this exact issue on Hetzner’s Plesk-managed virtual servers—let’s break down targeted fixes since the standard Apache .htaccess approach often fails here due to Plesk’s default nginx/Apache hybrid setup:

1. Fix Nginx Proxy Mode (Critical First Step)

Most Hetzner Plesk instances use nginx as a reverse proxy in front of Apache, which means nginx handles static requests directly and may bypass Apache’s rewrite rules entirely. Here’s how to fix this:

  • Log into Plesk, navigate to your domain’s Apache & nginx Settings
  • Scroll to Additional nginx directives and add this rule to forward dynamic requests to WordPress:
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    
  • Save the settings and restart nginx (Plesk usually does this automatically, but you can confirm via the "Restart Services" option if needed)

2. Correct Apache Directory Permissions in Plesk

Your earlier <Directory> directive might have used an incorrect path—Plesk provides a variable to avoid this. Update your Additional Apache directives to:

<Directory %docroot%>
    AllowOverride All
    Require all granted
</Directory>

This uses Plesk’s built-in %docroot% variable to target your site’s document root accurately, avoiding path mismatches that can block .htaccess from working.

3. Verify .htaccess Ownership & Permissions

Hetzner’s Plesk environment enforces strict file ownership rules. Ensure your .htaccess file has the right permissions:

  • If you have SSH access, run these commands (replace example.com with your domain):
    chown psaadm:psaadm /var/www/vhosts/example.com/httpdocs/.htaccess
    chmod 644 /var/www/vhosts/example.com/httpdocs/.htaccess
    
  • If you don’t have SSH, use Plesk’s File Manager to set ownership to psaadm and permissions to 644 (read/write for owner, read-only for group/others)

Even if your server config is fixed, WordPress might still be using outdated rewrite rules:

  • Log into your WordPress admin dashboard
  • Go to Settings > Permalinks
  • Don’t change any settings—just click Save Changes to trigger WordPress to re-generate and write the correct .htaccess rules

5. Check for ModSecurity Interference

Plesk’s default ModSecurity rules can sometimes flag WordPress permalink rewrites as suspicious. To test this:

  • In Plesk, go to Web Application Firewall (ModSecurity) for your domain
  • Temporarily disable ModSecurity and test your permalinks
  • If the 404s disappear, you’ll need to whitelist the rewrite rule in ModSecurity or adjust the rule set to exclude WordPress requests

Why Your Original Approach Failed

On standalone servers, Apache handles all requests, so AllowOverride All and .htaccess work directly. But Hetzner’s Plesk setup uses nginx as the front-end proxy, so nginx must be configured to forward non-static requests to Apache first—otherwise, your .htaccess rules never get applied.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 04:32:57