Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Location
    Indiana, USA
    Posts
    16,087

    Not sure where to ask this - Mod Rewrite Help

    Hello.

    We have four domains registered... I am trying to set up ModRewrite to do a few things but I'm not very good with it and I don't know anybody offhand that is.

    If you have free time and are willing to help that would be great.

    I've been trying to get it to do the following:
    Append a www. if there is no subdomain and www. is not present (ex. http://yourdomain.com/ -> http://www.yourdomain.com) but (http://subdomain.yourdomain.com/ stays http://subdomain.yourdomain.com/) Also if it's HTTP or HTTPS it needs to stay HTTP or HTTPS

    Also we have mdd-hosting.net, mddhosting.net mdd-hosting.com, that I would like to have a rewrite rule to make them go to mddhosting.com (and prepend a WWW if it's not there, and keep HTTP or HTTPS)

    I managed to get it working with a HUGE list of specific mod-rewrite and rewrite conditions but I'm sure there's a better way to do this.

    If you're bored, or just really good at this reply or drop me a line.

    Thanks!
    Michael Denney - MDDHosting LLC
    New shared plans for 2016! Check them out!
    Highly Available Shared, Premium, Reseller, and VPS
    http://www.mddhosting.com/

  2. #2
    Join Date
    Jan 2008
    Location
    India
    Posts
    46

  3. #3
    Join Date
    Dec 2007
    Location
    Indiana, USA
    Posts
    16,087
    My problem with that was, that if they are going to https://mddhosting.com/ it is redirecting to http://www.mddhosting.com/

    I was having to use two rewrite rules to accomplish HTTP and HTTPS.

    If anybody can help me consolidate these rules... That would be awesome.
    Michael Denney - MDDHosting LLC
    New shared plans for 2016! Check them out!
    Highly Available Shared, Premium, Reseller, and VPS
    http://www.mddhosting.com/

  4. #4
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    5,842
    Untested, but you probably want something like:
    Code:
    RewriteEngine On
    
    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP_HOST} ![a-z0-9]+.mddhosting.com
    RewriteRule (.*) http://www.mddhosting.com/$1 [R=301,L]
    
    RewriteCond %{HTTPS} on
    RewriteCond %{HTTP_HOST} !www.mddhosting.com
    RewriteRule (.*) https://www.mddhosting.com/$1 [R=301,L]
    Last edited by foobic; 03-11-2008 at 06:34 PM. Reason: allow subdomains on http only
    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
    Join Date
    Dec 2007
    Location
    Indiana, USA
    Posts
    16,087
    I've managed to get a working version but it has too many rules/conditions for my liking so I've pulled it down and I am looking for a better solution.

    It's not really *important* that it does this, I just would prefer it to do so for SEO.

    Thanks for your help guys
    Michael Denney - MDDHosting LLC
    New shared plans for 2016! Check them out!
    Highly Available Shared, Premium, Reseller, and VPS
    http://www.mddhosting.com/

Posting Permissions

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