this may have been asked before but I just want to be sure that it is correct in my case.
Basically i have few errors on PageChecking interfaces that i may have 2 pages available which may duplicate content. Currently i have HTTPS redirect from basic HTTP.
Although I need a redirect that redirects www to non www https and keeps the non-www adress and adds https.
This is how my htaccess looks like:
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]
These rewritecond with other urls are probably irrelevant so just let me know what shall I delete and fix please, thanks!
Check this modified rules on the top of your .htaccess file
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]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.