我有一个域名 searchglassfilms.com,我面临的问题是 searchglassfilms.com 没有响应。如何将所有对 searchglassfilms.com 的请求重定向到 www.searchglassfilms.com?我知道可以使用 .htaccess 来实现,但到目前为止我还没有找到解决方案。
searchglassfilms.com不管用www.searchglassfilms.com正在工作,为什么?
检查一下我做了一些事情:
# turn mod_rewrite on
RewriteEngine on
RewriteCond %{HTTP_HOST} ^[^.]*?\.?([^.]+\.[^.]+)$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^searchglassfilms\.com$ [NC]
RewriteRule ^(.*)$ http://www.searchglassfilms.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^searchglassfilms\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.searchglassfilms\.com$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
# Redirect non-www to www
Options +FollowSymLinks
# If https send to https://www.
RewriteCond %{HTTP_HOST} ^searchglassfilms.com$ [NC]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
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 ^(.*)$ https://www.searchglassfilms.com/$1 [R=301,L]
# If http send to http://www.
RewriteCond %{HTTP_HOST} ^searchglassfilms.com$ [NC]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
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 ^(.*)$ http://www.searchglassfilms.com/$1 [R=301,L]
有人能找出根目录中的 .htaccess 文件中出了什么问题吗?