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 05-01-2011, 04:52 AM   #1
accessthecloud
LQ Newbie
 
Registered: Apr 2011
Location: Glasgow, Scotland
Distribution: CentOS 5.5, Plesk 9-10
Posts: 9

Rep: Reputation: 0
Redirect Apache (mod_rewrite) from subdomain to https directory (vhost)


Hopefully I can find an answer here...

On one of my servers (Centos 5.5), I have been hosting a particularly complex CRM application for one of my clients. Recently they have asked about configuring SSL connections to the CRM. Problem is, SSL is already configured for their main domain but not the sub-domain where the CRM application is accessed.

Rather than purchasing another SSL certificate for their sub-domain (and probably another IP address), would it be possible to setup a redirection from the subdomain to a sub-directory in the SSL directory using mod_rewrite. I have searched online and through the other posts on LinuxQuestions but nothing I have tried works.

For example:

All requests made to http://sub.domain.com would be rewritten/redirected to https://domain.com/sub

Although this looks fairly simple, I have configured (Plesk) multiple virtual hosts that may cause problems.

Thanks in advance for any assistance.
 
Old 05-01-2011, 08:10 AM   #2
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
Hi,

You can use Recirect inside the vhost definition of sub.domain.com
Code:
<VirtualHost ...>
...
ServerName sub.domain.com
Redirect / https://domain.com/sub/
...
</VirtualHost>
Regards
 
1 members found this post helpful.
Old 05-02-2011, 07:07 AM   #3
accessthecloud
LQ Newbie
 
Registered: Apr 2011
Location: Glasgow, Scotland
Distribution: CentOS 5.5, Plesk 9-10
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks, I wonder why I was thinking I needed something more complex?

This is perfect
 
  


Reply

Tags
vhosts



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
.htaccess redirect non-existent directory to subdomain PlymWS Linux - Server 2 03-12-2011 11:19 AM
Apache mod_rewrite to https ALInux Linux - Server 2 07-26-2010 10:11 AM
LXer: Subdomain Redirection Using htaccess And mod_rewrite On Apache For Linux Or Uni LXer Syndicated Linux News 0 02-27-2009 09:00 AM
mod_rewrite: redirect depending on subdomain mysql_connect Linux - Server 1 08-01-2007 06:23 AM
apache: mod_rewrite in mass vhost setup NaX Linux - Server 1 10-12-2006 03:45 AM

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

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