.htaccess設定に問題があります。私のウェブサーバはApache2で、私のウェブサイトはPHPでコード化されています。しかし、私は.htaccessにいくつかの問題があります。Apache2でSSL/HTTPS経由でアクセスできない.htaccessが動作しない
私はnon-ssl(http://mywebsite.dev)でアクセスしていますが、私の.htaccessは動作していました。私は.htaccessをURLリライトに使用し、カスタムテンプレートによるエラーを処理します。しかし、SSL(https://mywebsite.dev)でアクセスすると、インデックスページが機能しました。しかし、https://mywebsite.dev/page/aboutにアクセスすると、ディスプレイ404が見つかりませんでした(私のカスタムページではなく、デフォルトの404が見つかりませんでした。つまり、.htaccessコードが読み込まれません)。
私のURLの構造は、http://mywebsite.dev/?load=page&page=aboutでした。 http://mywebsite.dev/page/aboutにアクセスすると動作します。しかし、SSL経由ではありません。問題は何ですか?
<VirtualHost *:80>
ServerName mydomain.com
ServerAdmin [email protected]
DocumentRoot /var/www/html/website/
<Directory /var/www/html/website>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# enabled or disabled at a global level, it is possible to
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
そして、私の.htaccessのコードは次のとおりです:ところで、私の/etc/apache2/sites-available/website.confコードがある
RewriteEngine On
RewriteRule ^page/([A-Za-z0-9-]+)/?$ index.php?load=page&page=$1 [NC]
ErrorDocument 404 /public/404.html
私はWindowsでLaragonを使用して、それを開発しています。 Production envはUbuntu 16、PHP 7、Apache2です。ありがとう。
文法の間違いで申し訳ありません、またはあなたが私の意味を理解していません。ありがとうございました。私の質問を読んでいただきありがとうございます:)
つまり、別のポートを持つ新しい仮想ホストを作成し、https経由でリクエストを処理する必要があります。間違っていますか? CMIIW。レスポンスありがとう。 – filosofikode
あなたは、httpとhttpsを処理するために2つの仮想ホストが必要です(サーバーの問題はまさにそれです)。 httpsでサーバにアクセスできる場合は、すでに 'SSLEngine on'(そして他の 'SSLCertificateFile')をどこかに持っています。それを適応/再利用する必要があります。 –