Doing an htaccess redirect for www to non-www with https?
Please bear with me on this. I'm a small business owner and have been doing my own website, hosted at my ISP. I know almost nothing about this. But some people in a SEO forum mentioned that I have a www and non-www version of my site out there. Both are https. And apparently Google sees this as two sites, thinks it's duplicated, and downgrades it. So I need to do some code in a htaccess file. The following is some code that people suggested that I use, 2 years ago, with the redirect added, but when I add this redirect, I get a server error after that. So could you please look this over and if the code after it is causing me problems too, please help me correct it all? Thanks!
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.net [NC]
RewriteRule ^(.*)$ https://example.net" /$1 [L,R=301]
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \
\.(?:exe|t?gz|zip|bz2|sit|rar)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
FileETag none
## EXPIRES CACHING ##
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 year"
ExpiresByType text/javascript "access 1 year"
ExpiresByType application/pdf "access 1 year"
ExpiresByType text/x-javascript "access 1 year"
ExpiresByType application/x-shockwave-flash "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 year"
## EXPIRES CACHING ##
Header append Vary Accept-Encoding
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
Header append Vary User-Agent env=!dont-vary
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
FileETag None
FileETag None
FileETag None
Header set Connection keep-alive
-
Hello @Melissa2019B , What I understand that the URL should be only one (forcefully from ) like: 0 -
I don't know. How would I tell? 0 -
You can check the CMS by entering the website URL on the link below: whatcms.org/ Once you get to know the CMS, an adequate solution can be looked for accordingly. 0 -
We didn't detect a CMS, but we found this. - Removed - indicates they are using Responsive Site Designer 1.5.1419 0 -
Check once through builtwith.com/ and have a look "Frameworks" section. 0 -
indicates they are using Responsive Site Designer 1.5.1419
They have their own support forums worth checking out I suppose: coffeecup.com/forums/responsive-site-designer/the-cpanels-autossl-certificate/ That should help with the redirects. As for the rest of your original posts htaccess stuff, you could try adding one section at a time and see which one is breaking the site. IMHO, you should probably give up on coffeecup software for a website builder and move to something more modern. Checking your website, it's quite dated and not responsive at all.0 -
A nice guy with my ISP took some mercy on me, and corrected the redirect and uploaded the .htaccess. He asked that I please not mess with it myself anymore, and I agree. :) But it works now. If you enter with www it instantly redirects do example.com Thanks people! 0 -
Great success! 0
Please sign in to leave a comment.
Comments
8 comments