Apache サーバーで特定のパス / 価格設定で 404 を取得する

Apache サーバーで特定のパス / 価格設定で 404 を取得する

Ubuntu 20.04にApacheサーバーをセットアップしました

最初にホームページを読み込むと、サイトは正常に読み込まれます(https://leadzilla.ai)その後、価格設定ボタンをクリックすると、https://leadzilla.ai/pricingそのページも正常に読み込まれます。

しかし、直接https://leadzilla.ai/pricingブラウザでは404が表示されます

私が持っているものは次のとおりです/etc/apache2/sites-available/leadzilla.ai.conf

<VirtualHost *:80>
    DocumentRoot /var/www/leadzilla.ai
    ServerName leadzilla.ai
    ServerAlias www.leadzilla.ai

    <Directory /var/www/leadzilla.ai>
        Options Indexes FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Allow from all
    </Directory>

RewriteEngine on
RewriteCond %{SERVER_NAME} =leadzilla.ai [OR]
RewriteCond %{SERVER_NAME} =www.leadzilla.ai
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

この設定は/etc/apache2/sites-available/leadzilla.ai-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    DocumentRoot /var/www/leadzilla.ai
    ServerName leadzilla.ai
    ServerAlias www.leadzilla.ai

    <Directory /var/www/leadzilla.ai>
        Options Indexes FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Allow from all
        #Deny from all
        #Allow from 127.0.0.1
        #Allow from ::1
    </Directory>
    <Directory /var/www/leadzilla.ai/blog>
        AllowOverride All
    </Directory>

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/leadzilla.ai/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/leadzilla.ai/privkey.pem
</VirtualHost>
</IfModule>

私はWordpressを使っていますhttps://leadzilla.ai/blogなので、それも考慮する必要があります。

私が試したことは次のとおりです: RewriteRule ^pricing$ pricing.html [NC]

他の書き換えルールの前に追加しましたが、機能していないようです。何かアイデアはありますか?

[編集]

これは解決されました。問題は Apache 構成ではなく、Next.js 構成でした。

私はexportTrailingSlash: trueそれを入れてmodule.exports、それがうまくいきました

答え1

これは奇妙な動作だと思います。しかし、RewriteRuleにがある場合<VirtualHost *:443>、 も存在するはずですRewriteEngine On

ディレクトリ内にシンボリック リンクはありますか? のようなものはありますかfoo -> foo.html?

ディレクトリ構造内に /var/www/html/pricing/ のようなディレクトリはありますか?

また、すべてのトラフィックは最終的に HTTPS で終わるため、 のみが<VirtualHost *:443>機能することに注意してください。他の仮想ホスト エントリは、HTTP から HTTPS にリダイレクトするのに十分な時間だけ使用されます。:80 VirtualHost の書き換えルールは、HTTPS には適用されません。

関連情報