繁体   English   中英

.htaccess配置错误

[英].htaccess misconfiguration issue

我将1and1用作网络主机,并被告知要为我的网站启用https,我需要在.htaccess文件中添加以下行

RewriteEngine On

RewriteBase /
RewriteCond %{HTTP_HOST} !^www\ooples.com\.com$ [NC]
RewriteRule ^(.*)$ https://www.ooples.com/$1 [R=301,L]

我目前将网站目标设置为webspace文件夹/ Ooples,这是我进行更改后当前的.htaccess文件的外观:

############################################
## enable rewrites

Options +SymLinksIfOwnerMatch
RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

RewriteBase /Ooples
RewriteCond %{HTTP_HOST} !^www\ooples.com\.com$ [NC]
RewriteRule ^(.*)$ https://www.ooples.com/$1 [R=301,L]

这是我第一次编辑.htaccess文件,当我进入网站时,出现500内部服务器错误。 有人知道我在做什么错吗?

只要您拥有该域的SSL证书,这样的事情就应该起作用:

RewriteBase /
RewriteCond %{HTTP_HOST} ooples\.com [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.ooples.com/$1 [R=301,L]

如果确实他们已经为您的域安装了证书,则在下面添加.htaccess规则将确保所有请求均通过https服务:

RewriteEngine On

RewriteCond %{HTTP_HOST} ooples\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.ooples.com/$1 [R,L]

但是请记住,它不应该导致服务器错误。 请检查服务器日志中是否存在错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM