1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Docs] Example .htaccess Files

Discussion in 'Getting Started with Hotaru CMS' started by Nick, Nov 29, 2009.

  1. Nick

    Nick Well-Known Member

    The .htaccess file is used for friendly urls. By default, friendly urls are disabled in Admin -> Settings. If you turn them on, you will need to rename your htaccess_default.php file to .htaccess and edit it as shown below.

    The .htaccess file can be quite daunting to look at, but we can make it much easier on the eye by focusing only on the section that needs editing:

    Code:
    #############################
    ##### EDIT THIS SECTION #####
    #############################
    
    ##### Re-directing Begin #####
    Options +Indexes +FollowSymlinks
    RewriteEngine on
    ## If Hotaru is installed in a subfolder, change the below line to RewriteBase /name-of-subfolder
    RewriteBase /
    ## If installed in a subfolder you may need to add ## to the beginning of the next line
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
    
    ## Remove these two lines if you have a sub-domain like  http://bookmarking.myhotarusite.com  or http://localhost
    ## Keep if your site url looks like http://www.myhotarusite.com
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^\/?(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    ##### Re-directing End #####
    Let's make it less verbose by stripping out the commented parts in these common examples:

    Example 1: http://www.mysite.com

    Code:
    Options +Indexes +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^\/?(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    Example 2: http://mysite.com/hotaru

    Code:
    Options +Indexes +FollowSymlinks
    RewriteEngine on
    RewriteBase /hotaru
    
    ## RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
    ## RewriteCond %{HTTP_HOST} !^www\.
    ## RewriteRule ^\/?(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    Example 3: http://hotaru.mysite.com

    I think this should be the same as Example 2, but I'll wait for someone to PM me or another moderator with confirmation before we put it here.
     

Share This Page