LinuxQuestions.org
Visit Jeremy's Blog.
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 09-07-2008, 11:45 AM   #1
firefly2442
Member
 
Registered: Apr 2003
Location: USA
Distribution: Ubuntu
Posts: 95

Rep: Reputation: 15
Question Apache httpd.conf Redirect Subdomain


Hello all,

I'm trying to do this without using mod_rewrite in Apache. Basically, I want to be able to redirect http://www.mydomain.com/webmail/ to https://www.mydomain.com/webmail/ as well as my subdomain http://webmail.mydomain.com to https://webmail.mydomain.com

Here is my httpd.conf file:

Code:
NameVirtualHost *:80
<VirtualHost *:80>
</VirtualHost>
<VirtualHost *:80>
    ServerName webmail.mydomain.com
    ServerAlias www.webmail.mydomain.com
    DocumentRoot /var/www/html/webmail
	Redirect permanent webmail.mydomain.com https://webmail.mydomain.com
</VirtualHost>

#This works ->
Redirect permanent /webmail https://webmail.mydomain.com
I'm not quite sure what I'm doing wrong, can anyone offer advice?

Thanks in advance!
 
Old 09-07-2008, 12:14 PM   #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
Quote:
Redirect permanent webmail.mydomain.com https://webmail.mydomain.com
You must provide an absolute path in order for the Redirect directive to work. So I guess, the following should work:
Code:
Redirect permanent / https://webmail.mydomain.com
 
Old 09-07-2008, 12:35 PM   #3
firefly2442
Member
 
Registered: Apr 2003
Location: USA
Distribution: Ubuntu
Posts: 95

Original Poster
Rep: Reputation: 15
Awesome thanks. I can't believe I missed that. I tried it earlier but I think it was outside the virtualhost tags and so it was directing all traffic to the subdomain (obviously not what I wanted).

Thanks again!
 
Old 05-10-2012, 01:06 AM   #4
basu2007
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
Smile Redirect certain request to an given URL

Hi,

I have question regarding redirecting certain request to given URL

For Example:

Would like to redirect all request other than /Webmail to //webmail.raj.net...

Can you please let me know how to do it...
I need your help ASAP.....

Great Thanks
Raj & Karthik
 
Old 05-10-2012, 03:05 AM   #5
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
It would be best if you start your own new thread with the topic that describes your problem and maybe refer to this thread in it if it's related.

Don't pull out the threads already given solution which is not yours.
If this tread doesn't help you then start a new thread with your problem described.
 
  


Reply

Tags
apache2, config, files, redirect, virtualhost



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
Starting httpd: httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Syntax sethukpathi Linux - Networking 6 04-12-2008 11:26 AM
Please amend apache conf/httpd.conf file please payjoe Linux - Newbie 7 09-21-2007 05:12 PM
Failed to start apache :Starting httpd: Syntax error on line 1027 of /etc/httpd/conf/ payjoe Linux - Newbie 3 09-21-2007 07:24 AM
httpd chokes on ScriptAlias line in Apache httpd.conf lhoff Linux - Software 1 07-14-2003 10:32 PM
apache httpd.conf plisken Linux - Software 1 02-01-2003 02:01 PM

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

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