1
現在、私の.htaccessはこのように見え、httpに最適です。 www.
にリダイレクトされ、.html
というファイル拡張子が削除されます。wwwをリダイレクトし、 ".html"拡張子を含むhtaccessのhttpsルール
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
私は.htaccessのfrom this answerを試してみましたが、まだ問題のサイトは完全に台無しにされています。たとえば、https://example.com/work
は404を示します。ソースコード内で/img/example-01.jpg
にリンクされているすべての画像も表示されません。
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
あなたは.htaccessファイルの取得で私を助けてください:
1.
httpsにリダイレクト
2.
は、ファイルの拡張子から.html
を削除しwww.
サブドメインに
3.
をリダイレクトにその結果、example.com/work
にはwork.html
ページが表示されます。
はあなたの助けをいただき、ありがとうございます。
いやは、'https:'httpsと同じ404で//www.example.com/work'結果、:// WWWを.example.com/img/desktop/1.jpg 'と入力します。これはLet's Encrypt証明書です。すでにホストに連絡しています。このサイトは静的コンテンツを持つ超簡単です。 – lowtechsun
.htaccesssを完全に削除すると、 'https:// www.example.com/img/desktop/1.jpg'が動作しますか? –
ちょうどチェックし、いいえ、動作しません。正確に言うと、wwwへのリダイレクトはありません。削除された.htaccess URL'https://example.com/img/desktop/1.jpg 'は機能しません。 – lowtechsun