Skip to content

Instantly share code, notes, and snippets.

@habibimroncn
Forked from chrisvasey/.htaccess
Created June 1, 2023 12:54
Show Gist options
  • Save habibimroncn/97d925844509bbb2af8aa29b49c3af74 to your computer and use it in GitHub Desktop.
Save habibimroncn/97d925844509bbb2af8aa29b49c3af74 to your computer and use it in GitHub Desktop.

Revisions

  1. @chrisvasey chrisvasey revised this gist Aug 7, 2017. No changes.
  2. @chrisvasey chrisvasey created this gist Aug 7, 2017.
    34 changes: 34 additions & 0 deletions .htaccess
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    Options -Indexes
    # .htaccess primary domain to web redirect
    # this file must be in the (public_html | web ) folder of your hosting account
    # make the changes to the file according to the instructions.

    <IfModule mod_rewrite.c>
    # Do not change this line.
    RewriteEngine on

    # Change %host% to be your primary domain.
    RewriteCond %{HTTP_HOST} ^(www.)?%host%$

    # Change 'web' to be the folder you will use for your primary domain.
    RewriteCond %{REQUEST_URI} !^/web/

    #********************
    # NOT RRCOMMENDED *
    #********************
    #
    # Uncomment those two lines if you want dirs and files to be accessible out of the
    # your primary domain dir.

    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d

    # Change 'web' to be the folder you will use for your primary domain.
    RewriteRule ^(.*)$ /web/$1

    # Change %host% to be your primary domain again.
    # Change 'web' to be the folder you will use for your primary domain
    # followed by / then the main file for your site, index.php, index.html, etc.
    RewriteCond %{HTTP_HOST} ^(www.)?%host%$
    RewriteRule ^(/)?$ web/index.php [L]
    </IfModule>