homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Redirect subdomain to secure

10+ Year Member

Msg#: 4402861 posted 10:31 pm on Jan 1, 2012 (gmt 0)

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



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

Msg#: 4402861 posted 10:36 pm on Jan 1, 2012 (gmt 0)

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


10+ Year Member

Msg#: 4402861 posted 12:54 pm on Jan 3, 2012 (gmt 0)

Hi g1smd

What I'm trying to do is stop the SE's indexing content at httpS://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.


10+ Year Member

Msg#: 4402861 posted 12:08 pm on Jan 5, 2012 (gmt 0)

Bump :)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved