SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,658
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    If I no longer have addon domains is this canonical code still appropriate?

    If I no longer have addon domains is this canonical code still appropriate? This code went through so many revisions over the years I don't remember anymore "exactly" what it did. Can you take a look and just let me know if this is perfect for a lone domain with no addon domains anymore to consider? I went ahead and moved all my addon domains over to it's own hosting. Thanks!

    Code:
    # Rewrite index.html/php to folder - First line excludes Forum
    RewriteCond $1 !^forum/adm(?:$|/)
    RewriteRule ^(.*/)?index\.(html?|php)$ /$1 [R=301,L]
    
    # Rewrite non-www (non-canonical) to www - First line excludes Forum
    RewriteCond $1 !^forum/adm(?:$|/)
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    PT,

    Sure. After all, what you were doing was redirecting from your domain to www.your domain. If it makes you feel better, replace %{HTTP_HOST} with your domain name.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,658
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    PT,

    Sure. After all, what you were doing was redirecting from your domain to www.your domain. If it makes you feel better, replace %{HTTP_HOST} with your domain name.

    Regards,

    DK
    Cool thank you. Like CSS saying #id .class {...} is one millions of a sec faster than saying #id .class #id .class {...}. Does speed come into play with that at all? %{HTTP_HOST} vs domain

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    PT,

    Ha! You've got me on that one: Timing difference between text in the code and simply using an Apache variable? I'd think that the text would be minutely faster but only in micro or nano seconds. Not enough to worry about (IMHO).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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