Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    May 2006
    Location
    Johannesburg, South Africa
    Posts
    944
    cPanel/Enkompass Access Level

    Root Administrator

    Default wildcart redirect? - http://www.mydomain.com -> http://mydomain.com

    Hi all

    I want to redirect all request to a certain subdomain to http://sub.domain.com - due to the fact that there's a SSL on that domain

    So, if someone were to type in http://www.sub.domain.com, I need it to be rediredted to https://sub.domain.com, but can't see to figure out how.


    Here's the code I have so far:

    Code:
    # RewriteEngine on
    # RewriteCond %{HTTP_HOST} ^sub.domain.com$ [OR]
    # RewriteCond %{HTTP_HOST} ^www.sub.domain.com$
    # RewriteRule ^(.*)$ https://sub.domain.com [R=301,L]

    The problem is, if someone needs to access https://sub.domain.com/folder1/download/file.zip, but types in http://www.sub.domain.com/folder1/download/file.zip, he get's redirected to https://sub.domain.com

    What am I missing?

    tia
    • cPanel :: Fantastico :: RVSkin :: WHM :: ModernBill
    • Reseller Hosting :: SSL Certificates :: Domain Registrations :: Affiliate Program
    • Blog Hosting :: CMS Hosting :: Forum Hosting :: E-Commerce Hosting
    SoftDux- The Leaders in Software
    Use the coupon: cpanel-06 to get 20% off our packages

  2. #2
    Member critter's Avatar
    Join Date
    Nov 2003
    Location
    Amarillo, Texas
    Posts
    59

    Default

    Anyone got an answer to this? I need to do the same thing.

  3. #3
    Member
    Join Date
    Mar 2005
    Posts
    75

    Default

    Quote Originally Posted by critter View Post
    Anyone got an answer to this? I need to do the same thing.

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

    found that with google

  4. #4
    Member critter's Avatar
    Join Date
    Nov 2003
    Location
    Amarillo, Texas
    Posts
    59

    Wink

    Thanks Pross, I found this one in another thread.

    RewriteEngine On
    RewriteCond %{SERVER_PORT} !443
    RewriteRule ^(.*)$ https://YOUR_DOMAIN/$1 [R,L]

  5. #5
    Member critter's Avatar
    Join Date
    Nov 2003
    Location
    Amarillo, Texas
    Posts
    59

    Default

    Hmmm ... ok neither of these remove www. Both work fine getting people to https://**** but I need someone looking for http://www.domain.com/*** to be redirected to https://domain.com/***.

    That is, I need to add the s & remove the www.

    Anyone got any ideas?

  6. #6
    Member critter's Avatar
    Join Date
    Nov 2003
    Location
    Amarillo, Texas
    Posts
    59

    Default

    Would this work?

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://your_domain.com%{REQUEST_URI}

  7. #7
    Member critter's Avatar
    Join Date
    Nov 2003
    Location
    Amarillo, Texas
    Posts
    59

    Default

    Well cool, I guess talking to yourself works wonders, the above works just great.

    Thanks Pross for pointing me in the right direction.
    Last edited by critter; 06-07-2007 at 09:30 PM.

Similar Threads & Tags
Similar threads

  1. http://www.mydomain.com/cpanel DONT RUN
    By jmginer in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-15-2006, 04:49 AM
  2. Cannot access http://mail.mydomain.com since transfer to another server
    By djblamire in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 10-14-2006, 11:03 AM
  3. Replies: 9
    Last Post: 04-21-2005, 03:56 AM
  4. site http://mydomain.com/cpanel doesn't come up?
    By simonlee in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 09-15-2003, 08:19 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube