301在Chrome中无法将https非www重定向到www htaccess

时间:2019-03-03 12:37:37

标签: apache .htaccess redirect

我想将http://nyarfadent.hu重定向到https://www.nyarfadent.hu 在Chrome中显示结果:

Not Found
The requested URL /https://nyarfadent.hu/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

我的.htaccess文件:

#rewrite http://nyarfadent.hu
RewriteCond %{HTTP_HOST} ^nyarfadent\.hu$ [OR]
RewriteCond %{HTTP_HOST} ^www\.nyarfadent\.hu$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^www\.nyarfadent\.hu$ "https\:\/\/www\.nyarfadent\.hu\/" [R=301,L]

# Redirect non-www to www
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

0 个答案:

没有答案