Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-18-2012, 02:29 AM   PM User | #1
MrTIMarshall
Regular Coder

 
Join Date: Nov 2010
Posts: 347
Thanks: 44
Thanked 1 Time in 1 Post
MrTIMarshall is an unknown quantity at this point
Exclamation .htaccess problem

Hello,

My .htaccess will redirect from:

From: www.example.com/
To: https://example.com/
From: http://www.example.com/
To: https://www.example.com
From: http://example.com/
To: https://example.com

but not:

From: http://www.example.com/
To: https://example.com/

.htaccess Code:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
Note: I have replaced my websites name with domain due to being under lock and key for the time being.

Does anyone have any idea how to fix this please?

Best Regards,
Tim

Last edited by VIPStephan; 08-18-2012 at 11:13 AM.. Reason: changed domains to example.com
MrTIMarshall is offline   Reply With Quote
Old 08-18-2012, 11:15 AM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,699
Thanks: 5
Thanked 875 Times in 850 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
If you use example domains then please use example.com since that is what it’s there for (or at least disable auomatic link parsing in posts; there is a checkbox for that below the reply field). We don’t wanna advertise a third party domain hosting site, do we?
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 08-18-2012, 03:01 PM   PM User | #3
MrTIMarshall
Regular Coder

 
Join Date: Nov 2010
Posts: 347
Thanks: 44
Thanked 1 Time in 1 Post
MrTIMarshall is an unknown quantity at this point
Quote:
Originally Posted by VIPStephan View Post
If you use example domains then please use example.com since that is what it’s there for (or at least disable auomatic link parsing in posts; there is a checkbox for that below the reply field). We don’t wanna advertise a third party domain hosting site, do we?
Sorry VIPStephan
MrTIMarshall is offline   Reply With Quote
Old 08-28-2012, 06:12 PM   PM User | #4
handlegeek
New to the CF scene

 
Join Date: Aug 2012
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
handlegeek is an unknown quantity at this point
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Will get applied for http://www.example.com/ and hence it will redirect to http://example.com and not https://example.com.

Moreover i see there is no https://www.example.com destination in the RewriteRule.
handlegeek is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:45 PM.


Advertisement
Log in to turn off these ads.