Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirect subdomain to secure



10:31 pm on Jan 1, 2012 (gmt 0)

10+ Year Member

I have a site that has the same document root for both http:// and https:// (Historical and can't be changed due to some coding issues.)

the subdomain for https:// is secure.domain.tld however this can also be accessed through [secure.domain.tld...]

Can somebody advise how I can use .htaccess to force https:// if somebody enters [secure.domain.tld...]

Thank you in advance


10:36 pm on Jan 1, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Which of these previously discussed solutions have you tried so far?
[google.com...] (webmasterworld) [google.com...] (webmasterworld)
You'll need a RewriteRule or two.


12:54 pm on Jan 3, 2012 (gmt 0)

10+ Year Member

Hi g1smd

What I'm trying to do is stop the SE's indexing content at [secure.domain.tld...] to avoid a dupe content penalty.

Here's where I've go to.

I've included the following in the .htaccess

RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^robots.txt$ robots_ssl.txt

I then have the following in my robots_ssl.txt

User-agent: *
Disallow: /

This is working fine and the correct robots.txt is being displayed if I browse to httpS: //secure.domain.tld

However if I browse to http ://secure.domain.tld it's exactly the same as browsing to http: //www.domain.tld

What I'm trying to achieve is any SE entering at http: //secure.domain.tld will be redirected to httpS: //secure.domain.tld and the appropriate robots.txt will be displayed.

Hope this makes sense.


12:08 pm on Jan 5, 2012 (gmt 0)

10+ Year Member

Bump :)

Featured Threads

Hot Threads This Week

Hot Threads This Month