Results 1 to 6 of 6
  1. #1

    .htaccess redirection rule

    Trying the following rule to only allow https://webmail.aaa.net and redirect all other http(s) requests to http://www.aaa.net but all my traffic is redirected. WHat do I need to chaneg on my condition rule.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^https://webmail\.aaa\.net
    RewriteRule ^(.*)$ http://www.aaa.net/$1 [R=301,L]

  2. #2
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    5,842
    Warning: untested!

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^webmail\.aaa\.net [OR]
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^(.*)$ http://www.aaa.net/$1 [R=301,L]
    Chris

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

  3. #3
    Thanks, but all URL's are still rewriten to http://www.aaa.net

  4. #4
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    5,842
    Well, I just tried it and it works for me. Are you sure you don't have any other redirects in place? Perhaps webmail.aaa.net has been rewritten already by the time it gets to this rule.

    Another thought: Try the 2 conditions individually to see which one's failing.

    Edit: also run phpinfo and see what it shows for HTTP_HOST
    Chris

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

  5. #5
    HTTP_HOST provides a server address and not my fixed address. Can I put here my IP address?

  6. #6
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    5,842
    Sounds like you may not have a virtualhost entry for webmail.aaa.net - how did you set it up? (in CPanel an addon domain should work)
    Chris

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •