LinuxQuestions.org
Visit the LQ Articles and Editorials section
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, 06:39 AM   #1
maniannam
Member
 
Registered: Dec 2007
Location: India
Distribution: fedora 11
Posts: 64

Rep: Reputation: 15
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, 05:08 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,957

Rep: Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341
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, 02:03 AM   #3
maniannam
Member
 
Registered: Dec 2007
Location: India
Distribution: fedora 11
Posts: 64

Original Poster
Rep: Reputation: 15
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:56 PM
url redirect Present Linux - Networking 4 01-26-2007 10:08 AM
Apache URL issue - will redirect help... rlprofessional Linux - Newbie 9 06-16-2006 12:43 PM
Apache URL redirect problem kdogksu Linux - Networking 2 03-26-2005 03:22 PM
Apache Virtual URL Redirect nxny Linux - Software 0 07-19-2002 03:36 PM


All times are GMT -5. The time now is 04:47 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration