LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-26-2010, 09:44 AM   #1
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676
Blog Entries: 7

Rep: Reputation: 32
Apache mod_rewrite to https


Hi All
I have a website with three hostnames x y and z. x is the main url and I have a valid SSL certificate for it. Basically, I have no problem if a page is accessed through http, however if an https page is requested when a users registers or when a user logs in or over a few https links I want the url to be redirected to from y and z to https://x.

Example

https://y.com/test.php should go to https://x.com/test.php
https://z.com/test.php should go to https://x.com/test.php

Where test.php could be any URL.

In short, any https page requested if it is not going for hostname x it should be redirected to hostname x.

Any help please ?

Thanks
 
Old 07-26-2010, 09:53 AM   #2
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
I assume your issue is the certificate error when the page is accessed through one of the other hostnames. In this case, rewriting won't help because the error happens at SSL handshake time which ist before all other request processing in apache.

If you can get certificates for the other hostnames, too, you can install mod_gnutls which supports "server name indication", so you can use name-based virtual hosts for ssl, too.

If not, you can change your web application's logic (maybe define the primary domainname somewhere as a class constant) to always use the primary hostname when linking to a https page.
 
Old 07-26-2010, 10:11 AM   #3
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
My assumption is that a redirect wont work since the symptoms you mentioned happens but a rewrite will actually rewrite all the urls in the http/php page and therefore the actual request will be initiated to the valid SSL certificate, I.e. the same way SEO URLs are rewritten you have index.php?x=10?page=login, it gets rewritten to index.php/10/login/
 
  


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
mod_rewrite to force https - password request happening first sneakyimp Linux - Software 3 01-04-2010 12:37 AM
mod_rewrite vs https riluve Linux - Software 2 09-05-2007 01:58 PM
mod_rewrite - rule to change http to https Firebar Linux - Server 10 06-05-2007 07:29 AM
How to enable Apache mod_rewrite, after apache installed without this modue jCash Linux - Newbie 1 10-24-2006 10:23 AM
Apache:mod_rewrite MadMikie Linux - Software 0 08-03-2004 07:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:55 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