LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-24-2009, 07:53 AM   #1
nagavinodh
Member
 
Registered: Aug 2009
Posts: 118

Rep: Reputation: 15
redirect http to https


Hi,
how to redirect automatically from http://test.yan.com to https://test.yan.com.
we configured the ssl on test.yan.com in apache.

if https://test.yan.com,it is working.

if http://test.yan.com,it is not working and auotmatically redirected.

how to solve that
 
Old 09-24-2009, 08:18 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,597

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
You can use mod_rewrite:
Code:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}
Regards
 
Old 09-24-2009, 09:23 AM   #3
nagavinodh
Member
 
Registered: Aug 2009
Posts: 118

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
You can use mod_rewrite:
Code:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}
Regards
thanks for reply.mod-rewrite is not there on httpd.conf.where i have to mention that
 
Old 09-24-2009, 09:34 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,597

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
In you case, since you want to redirect all the traffic in https, it's better to put it inside the Directory definition of your DocumentRoot. I..e, if you have an entry "DocumentRoot /var/www", then you have to put it inside the <Directory /var/www>...</Directory> part.
But it can go everywhere, even inside a .htaccess.

Regards
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you properly redirect all web client requests from http to https? mehoggan Linux - Server 4 06-02-2009 04:49 AM
redirect https request to http after user authentication r.r.vishwanath@gmail.com Linux - Newbie 1 01-31-2009 12:42 PM
How to redirect http to https? Sovan Linux - Server 1 12-03-2008 02:11 PM
redirect http to https awreneau Linux - Server 17 10-14-2008 10:13 AM
redirect SquirrelMail from http to https using Apache2 cccc Linux - Server 3 09-23-2006 11:02 AM


All times are GMT -5. The time now is 10:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration