Forum Moderators: phranque
I am trying to fix an issue that has occureed in a development area. Google has managed to index my https site while it is in the development area of the domain, this was primarily due to the SEO we were working on getting the site indexed before the client had finished the SEO.
We now have an issue with google linking to a dev site using https and the dev site does not have a certificate, the certificate is for the live www site.
Every time anyone clicks a link from google to the https deve site they get a certificate warning. I am trying to figure out a work around and thought that a straight redirect using https and 301 in a .htaccess file should do it:
currently my redirect looks like this:
redirectMatch 301 ^(.*)$ [{DOMAIN...] NAME HERE}.com
redirectMatch permanent ^(.*)$ [{DOMAIN...] NAME HERE}.com
redirectMatch 301 ^(.*)$ [{DOMAIN...] NAME HERE}.com
redirectMatch permanent ^(.*)$ [{DOMAIN...] NAME HERE}.com
If anyone could suggest a way of the redirecting these google links I would be grateful - even a DNS CNAME redirect isn't sorting out the issue.
Thanks
Sticky
Your code can be improved and compacted by taking advantage of the power of RedirectMatch and regular expressions:
RedirectMatch 301 ^/(.*)$ http://www\.example\.com/$1
If you need to preserve the original http/https request protocol, and both http and https requests resolve to the same .htaccess file on the dev server, then you'll need to use mod_rewrite:
Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{SERVER_PORT}>s ^(443>(s)¦80>s)$
RewriteRule (.*) http%2://www.example.com/$1 [R=301,L]
[edited by: jdMorgan at 11:18 pm (utc) on Mar. 10, 2009]