找不到非www到www重定向库404页面

时间:2018-11-09 20:01:39

标签: .htaccess http-status-code-404 http-status-code-301

为非www配置为www的301重定向后,当我尝试访问非www地址的页面时出现404错误。 htacces文件:

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
#non www to www
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301,NC]

RewriteBase /
# redirect html pages to the root domain
RewriteRule ^index\.html$ / [NC,R,L]

当我尝试从非www地址(example.com)访问页面时 我收到404错误

[404] File Not Found     
    The requested URL /https://example.com/ was not found on this server.

0 个答案:

没有答案