这可能是以前问过的,但我只是想确保它对我来说是正确的。
基本上,我在PageChecking界面上几乎没有错误,我可能有2个可用页面,这些页面可能重复内容。目前,我已经从基本HTTP重定向到HTTPS。
尽管我需要将www重定向到非www https并保留非www地址并添加https的重定向。
这是我的htaccess的样子:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^website.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.website.com$
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{HTTP_REFERER} ^http://www.ownedcore/upl/usr/ [NC]
RewriteCond %{HTTP_REFERER} ^http://www.bananaforum.com/ [NC]
RewriteCond %{HTTP_REFERER} ^http://www.dafont.com/[NC]
RewriteCond %{HTTP_REFERER} ^http://goingsony.com/ [NC]
RewriteCond %{HTTP_REFERER} ^http://i.imgur.com/ [NC]
RewriteCond %{HTTP_REFERER} ^http://www.wallpapervortex.com/ [NC]
RewriteRule . https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !web/
RewriteRule (.*) /web/$1 [L]
这些与其他网址的rewritecond可能无关紧要,所以请让我知道我要删除并修复的内容,谢谢!
答案 0 :(得分:0)
在.htaccess文件顶部检查此修改后的规则
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule (.*) https://website.com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_REFERER} ^http://www.ownedcore/upl/usr/ [NC]
RewriteCond %{HTTP_REFERER} ^http://www.bananaforum.com/ [NC]
RewriteCond %{HTTP_REFERER} ^http://www.dafont.com/[NC]
RewriteCond %{HTTP_REFERER} ^http://goingsony.com/ [NC]
RewriteCond %{HTTP_REFERER} ^http://i.imgur.com/ [NC]
RewriteCond %{HTTP_REFERER} ^http://www.wallpapervortex.com/ [NC]
RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !web/
RewriteRule (.*) /web/$1 [L]