LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 12-30-2010, 06:52 AM   #1
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Rep: Reputation: 42
SSL Redirect


I have http running fine and ssl enabled for managers , the script detects by login credentials,and it works fine.


My problem is I want when a manger turns on ssl(the URL is now https://site.com), they get redirected to https://www1.site.com.

How can I do this please, in .htaccess ?

Thank you
 
Old 12-30-2010, 07:01 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well this has nothing at all to do with SSL, so just look at standard htaccess usage: http://www.tamingthebeast.net/articl...1-redirect.htm there's plenty of info there about www prefixes there for example.
 
Old 12-30-2010, 07:03 AM   #3
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Original Poster
Rep: Reputation: 42
I know I have this but it doesnt work

#RewriteCond %{HTTPS} !=on
#RewriteRule ^(/secure/.*) https://www1.site.com$1 [L,R=301]
 
Old 12-30-2010, 07:07 AM   #4
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Original Poster
Rep: Reputation: 42
Quote:
Originally Posted by acid_kewpie View Post
well this has nothing at all to do with SSL, so just look at standard htaccess usage: http://www.tamingthebeast.net/articl...1-redirect.htm there's plenty of info there about www prefixes there for example.
I searched google extensively, before coming here, and cant find a solution.I dont want it to redirect http: to http://www1. just if ssl is enabled.

I also tried
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]


But it doesnt work.
 
Old 12-30-2010, 07:07 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you mean it doesn't work when it's commented out with the # at the start?? And why would it work anyway? It is referencing a uri that you've not mentioned at all...
 
Old 12-30-2010, 07:11 AM   #6
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Original Poster
Rep: Reputation: 42
Quote:
Originally Posted by acid_kewpie View Post
you mean it doesn't work when it's commented out with the # at the start?? And why would it work anyway? It is referencing a uri that you've not mentioned at all...
lol I know its commented out lol...Its not like that in the .htaccess.

If I do it manually it works, so dont know what you are saying by "uri" maybe you mean mean URL...anyway if I go https://www1.site.com it works perfectly, but I need it to be automatic.
 
Old 12-30-2010, 07:56 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You can use:
Code:
RewriteEngine on

RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP_HOST}   !^www1.site1.com [NC]
RewriteRule (.*)         https://www1.site1.com/$1 [L,R]
 
Old 12-30-2010, 09:06 PM   #8
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Original Poster
Rep: Reputation: 42
Quote:
Originally Posted by bathory View Post
You can use:
Code:
RewriteEngine on

RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP_HOST}   !^www1.site1.com [NC]
RewriteRule (.*)         https://www1.site1.com/$1 [L,R]
OK thank you , but doesnt it need to check if SSL is actually on y this line?

RewriteRule ^(/secure/.*) https://www1.site.com$1 [L,R=301]
 
Old 12-30-2010, 09:12 PM   #9
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Original Poster
Rep: Reputation: 42
Tried it it does not work, as suspected it makes the entire site https even for non-managers
 
Old 12-31-2010, 01:02 AM   #10
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Original Poster
Rep: Reputation: 42
any help?
 
Old 12-31-2010, 04:13 AM   #11
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
My problem is I want when a manger turns on ssl(the URL is now https://site.com), they get redirected to https://www1.site.com.
This is what the rewrite does.
If you want something else, please clarify
 
Old 12-31-2010, 04:20 AM   #12
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
why does SSL matter here? Whilst you might want to insist on SSL only redirecting when SSL is in use to an address that a non-SSL connection can presumably reach anyway is nonsense.
 
Old 12-31-2010, 05:25 AM   #13
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Original Poster
Rep: Reputation: 42
Quote:
Originally Posted by acid_kewpie View Post
why does SSL matter here? Whilst you might want to insist on SSL only redirecting when SSL is in use to an address that a non-SSL connection can presumably reach anyway is nonsense.

Where in any of my posts you see non-SSL??Where in any of my explanations do you gather I want to redirect SSL to non-SSL.I maybe using using htaccess code that signifies that but that is not what I want, thus my request for assistance.

Anyways, When accessing https, it shows in the browser https://site.com , I want the browser to be changed to https://www1.site.com.How do I do that?
 
Old 12-31-2010, 05:31 AM   #14
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
no, that's not what I said. I said that it seems irrelevant if you're using SSL or not with regards to a redirection. You seem to be complicating things by associating stuff that doesn't relate. You might not want non-ssl connections to the site, and that's fine, but tha'ts not affecting a redirect.
 
Old 12-31-2010, 08:42 AM   #15
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Original Poster
Rep: Reputation: 42
Quote:
Originally Posted by acid_kewpie View Post
no, that's not what I said. I said that it seems irrelevant if you're using SSL or not with regards to a redirection. You seem to be complicating things by associating stuff that doesn't relate. You might not want non-ssl connections to the site, and that's fine, but tha'ts not affecting a redirect.
I still dont understand what you are saying, but you may be correct I might be complicating the issue.I have a UCC ssl certificate,it has my domain name on it along with www1 and www2 .The cert is installed and everything is running ok, except for the issue of when ssl is on,the blue bar up top in my browser doesn't appear and stay.It only appears and stay when I do www1.domain.com or www2.domain.com .thus my trouble when the site is in normal ssl mode I want it to show up like https://www1.domain.com instead of https://domain.com

P.S the blue bar doesnt show when I type the site any other way, e.g https://www.domain.com ,https://domain.com
 
  


Reply



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
Q: SMTP redirect to exchange over SSL r0b0jerk Linux - Networking 2 10-06-2009 12:07 PM
Squid transparent proxy won't redirect SSL, Help please! cereal83 Linux - Networking 2 08-15-2007 12:53 PM
Redirect to SSL-enabled website. haxpor Linux - Networking 1 03-20-2007 02:35 AM
Debian redirect apache to apche-ssl klyshi Linux - Software 1 10-04-2005 10:27 AM
Configuring Automatic SSL Redirect for Apache 2.0.50 kaplan71 Linux - Software 1 08-23-2005 05:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:24 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
Open Source Consulting | Domain Registration