LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-02-2009, 05:39 AM   #1
maniannam
Member
 
Registered: Dec 2007
Location: India
Distribution: fedora 11
Posts: 64

Rep: Reputation: 16
URL redirect in apache


I configured appace through source file.

In that i enabled http and https and Name based virtual

http://maniannam.com
https://secure.maniannam.com

my requirement is, if i type http://maniannam.com then this will be redirect to https://secure.maniannam.com

I enabled the rule but its not redirect.

my config httpd.conf

<VirtualHost 192.168.237.166:80>
servername www.maniannam.com
DocumentRoot /home/mani/pythian

</VirtualHost>
<VirtualHost 192.168.237.166:443>
servername secure.maniannam.com
DirectoryIndex index.html_https
DocumentRoot /home/mani/pythian/test
SSLEngine on
SSLCertificateFile /usr/local/apache2/conf/server.crt
SSLCertificateKeyFile /usr/local/apache2/conf/server.key
</VirtualHost>

RewriteLog "logs/rewrite.log"
RewriteLogLevel 9
<Directory /home/mani/pythian>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
RewriteEngine on
#RewriteLogLevel 3
#RewriteCond %{SERVER_PORT} ^80$
#RewriteRule ^/(.*) https://secure.maniannam.com
RewriteRule ^/$ https://secure.maniannam.com

</Directory>


rewrite log is :
192.168.237.166 - - [02/Jan/2009:16:55:45 +051800] [maniannam.com/sid#8f1cf88][rid#8f86d70/initial] (3) [perdir /home/mani/pythian/] strip per-dir prefix: /home/mani/pythian/ ->
192.168.237.166 - - [02/Jan/2009:16:55:45 +051800] [maniannam.com/sid#8f1cf88][rid#8f86d70/initial] (3) [perdir /home/mani/pythian/] applying pattern '^/$' to uri ''
192.168.237.166 - - [02/Jan/2009:16:55:45 +051800] [maniannam.com/sid#8f1cf88][rid#8f86d70/initial] (1) [perdir /home/mani/pythian/] pass through /home/mani/pythian/
192.168.237.166 - - [02/Jan/2009:16:55:45 +051800] [maniannam.com/sid#8f1cf88][rid#8f8ad80/subreq] (3) [perdir /home/mani/pythian/] strip per-dir prefix: /home/mani/pythian/index.html -> index.html
192.168.237.166 - - [02/Jan/2009:16:55:45 +051800] [maniannam.com/sid#8f1cf88][rid#8f8ad80/subreq] (3) [perdir /home/mani/pythian/] applying pattern '^/$' to uri 'index.html'
192.168.237.166 - - [02/Jan/2009:16:55:45 +051800] [maniannam.com/sid#8f1cf88][rid#8f8ad80/subreq] (1) [perdir /home/mani/pythian/] pass through /home/mani/pythian/index.html



Can any one help to me..... please...
 
Old 01-03-2009, 04:08 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
You can use the following rewrite rule:
Code:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^/(.*) https://secure.maniannam.com/$1 [R,L]
 
Old 01-05-2009, 01:03 AM   #3
maniannam
Member
 
Registered: Dec 2007
Location: India
Distribution: fedora 11
Posts: 64

Original Poster
Rep: Reputation: 16
sorry for the late reply.

Thanks for your response.

I tried your rewrite rule. Its not redirect the url, but log says

192.168.237.167 - - [05/Jan/2009:12:11:56 +051800] [maniannam.com/sid#8525fb8][rid#857dd20/initial] (1) [perdir /home/mani/pythian/] pass through /home/mani/pythian/
192.168.237.167 - - [05/Jan/2009:12:11:56 +051800] [maniannam.com/sid#8525fb8][rid#8581d30/subreq] (1) [perdir /home/mani/pythian/] pass through /home/mani/pythian/index.html
192.168.237.167 - - [05/Jan/2009:12:11:57 +051800] [maniannam.com/sid#8525fb8][rid#8585d40/initial] (1) [perdir /home/mani/pythian/] pass through /home/mani/pythian/favicon.ico
192.168.237.167 - - [05/Jan/2009:12:12:09 +051800] [secure.maniannam.com/sid#8526ce8][rid#85840b8/initial] (1) [perdir /home/mani/pythian/] pass through /home/mani/pythian/test/
192.168.237.167 - - [05/Jan/2009:12:12:09 +051800] [secure.maniannam.com/sid#8526ce8][rid#8598810/subreq] (1) [perdir /home/mani/pythian/] pass through /home/mani/pythian/test/index.html_https
192.168.237.167 - - [05/Jan/2009:12:12:09 +051800] [secure.maniannam.com/sid#8526ce8][rid#859a818/initial] (1) [perdir /home/mani/pythian/] pass through /home/mani/pythian/test/favicon.ico


Then i tired the below rule.

Redirect 301 /index.html https://secure.maniannam.com/index.html_https

Its working fine.

Thank you very much....
 
  


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
apache redirect to local url nkhetia Linux - Server 1 11-23-2008 03:56 PM
url redirect Present Linux - Networking 4 01-26-2007 09:08 AM
Apache URL issue - will redirect help... rlprofessional Linux - Newbie 9 06-16-2006 11:43 AM
Apache URL redirect problem kdogksu Linux - Networking 2 03-26-2005 02:22 PM
Apache Virtual URL Redirect nxny Linux - Software 0 07-19-2002 02:36 PM

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

All times are GMT -5. The time now is 09:13 AM.

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