IMPORTANT!

Snipt is going open source. We've toyed with this idea for quite a while, and have finally decided it's the right way to move forward.

A few things:
  • The entire Snipt source code will be released on GitHub under the 3-clause BSD License on Friday, September 10th.
  • While we'd like to think we're perfect, we realize we're only human. By open sourcing the software that runs this website, certain bugs or security flaws may be discovered that could compromise the privacy of your snipts.
  • Only the Lion Burger team will be able to push commits to the Snipt.net site. Contributors should send a pull request to add new features or submit patches.
  • By using this site, you agree not to be too angry or take any legal action against Lion Burger should this whole thing go up in flames some day.
  • Follow us on Twitter for updates.
I agree, close this message
Sign up to create your own snipts, or login.

Latest 100 public snipts » htaccess The latest public htaccess snipts.

showing 1-20 of 50 snipts for htaccess
  • php in html via .htaccess
    AddType application/x-httpd-php .php .htm .html
    

    copy | embed

    0 comments - tagged in  posted by dobersby on Sep 02, 2010 at 5:09 a.m. EDT
  • Htaccess Private Files (svn, cvs, sql, etc)
    # Drupal's way of denying access to delicate server files
    <FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
      Order allow,deny
    </FilesMatch>
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Aug 27, 2010 at 1:48 p.m. EDT
  • No www
    # no-www
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    

    copy | embed

    0 comments - tagged in  posted by trey on Jul 09, 2010 at 12:44 p.m. EDT
  • Security for WordPress
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    RewriteRule ^(.*)$ index.php [F,L]
    

    copy | embed

    0 comments - tagged in  posted by joeybaker on Jul 05, 2010 at 1:38 p.m. EDT
  • .htaccess user agent sniffing for iPhone
    RewriteEngine on
    RewriteCond %{HTTP_USER_AGENT} iPhone
    RewriteCond %{REQUEST_URI} !^/_mobile/
    RewriteRule .* /_mobile/ [R]
    

    copy | embed

    0 comments - tagged in  posted by gotoplanb on Jun 07, 2010 at 1:45 p.m. EDT
  • Custom HTACCESS rules used on Komrade's Joomla! sites
    ########## CUSTOM RULES - START ##########
    
    # Google Apps
    Redirect 301 /mail http://mail.google.com/a/domain.com
    
    # Added to prevent directory browsing
    Options -Indexes
    
    # Redirect to WWW
    rewritecond %{http_host} ^domain.com [nc]
    rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
    
    ########## CUSTOM RULES - END ##########
    

    copy | embed

    0 comments - tagged in  posted by fevangelou on Jun 05, 2010 at 9:17 p.m. EDT
  • code added to .htaccess to enable compression of certain served content using Apache mod_deflate
    # compress all text & html
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/x-js text/css application/x-javascript application/javascript
    

    copy | embed

    0 comments - tagged in  posted by frankfarm on Apr 25, 2010 at 1:25 p.m. EDT
  • WordPress 403 Error on (dv)
    You were experiencing 403 forbidden errors when going to links on a WordPress blog installed on your (dv) Dedicated-Virtual Server. This can happen when there is either an incorrect .htaccess file, or no .htaccess at all. 
    
    I suggest that you include a proper .htaccess for WordPress in order to clear up this issue. Below I have included the text area of a default WordPress .htaccess file. 
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    Generally this issue can be attributed to how WordPress handles permalinks within the .htaccess file. If you would like to learn more about how WordPress handles permalinks, I would suggest visiting the WordPress Codex at http://codex.wordpress.org/.
    

    copy | embed

    0 comments - tagged in  posted by abecker on Apr 04, 2010 at 1:22 p.m. EDT
  • htaccess redirect all traffic to homepage
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . http://domain.tld/index.php [L]
    </IfModule>
    

    copy | embed

    0 comments - tagged in  posted by rendrag on Feb 06, 2010 at 1:49 p.m. EST
  • mod_rewrite to fix blogger moving
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !^/blog/images/(.*)$ [NC]
    RewriteCond %{REQUEST_URI} ^/blog/(.*)$ [NC]
    RewriteRule ^blog/(.*)$ http://blog.domain.com/$1 [R=301,L]
    

    copy | embed

    0 comments - tagged in  posted by malkir on Feb 04, 2010 at 1:23 a.m. EST
  • Prevent .htaccess and .htpasswd file from being viewed by web clients
    #
    # The following lines prevent .htaccess and .htpasswd files from being 
    # viewed by Web clients. 
    #
    <Files ~ "^\.ht">
        Order allow,deny
        Deny from all
    </Files>
    

    copy | embed

    0 comments - tagged in  posted by yvoictra on Jan 16, 2010 at 6:02 p.m. EST
  • Apache non-www .htaccess config
    Options +FollowSymLinks
    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} !^apaair\.aero$ [NC]
    RewriteRule ^(.*)$ http://apaair.aero/$1 [R=301,L]
    
    # Important: It is needed to have mod_rewrite MODULE activated and have "AllowOverride Directive" set to ALL.
    

    copy | embed

    0 comments - tagged in  posted by yvoictra on Jan 16, 2010 at 9:05 a.m. EST
  • better .htaccess noindex
    Header set X-Robots-Tag "noindex, nofollow"
    

    copy | embed

    0 comments - tagged in  posted by alifity on Dec 18, 2009 at 1:37 a.m. EST
  • Basic query string rewriting with mod_rewrite
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [S=40]
    RewriteRule ^([A-Za-z0-9\_]+)?/?$ /index.php?page=$1 [QSA,L]
    
    RewriteRule ^(events|news)/([0-9]+)/?$ /index.php?page=$1&id=$2 [L]
    RewriteRule ^(events|news)/([0-9]+)/([0-9]+)/([0-9]+)/?$ /index.php?page=$1&year=$2&month=$3&id=$4 [L]
    RewriteRule ^(events|news)/([0-9]+)/([0-9]+)/?$ /index.php?page=$1&year=$2&month=$3 [L]
    #RewriteRule ^([^/\.]+)/?$ /index.php?page=$1 [L]
    </IfModule>
    

    copy | embed

    0 comments - tagged in  posted by trey on Dec 02, 2009 at 4:54 p.m. EST
  • 301 redirect - non-www to www
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example.com
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]
    

    copy | embed

    0 comments - tagged in  posted by carsonblack on Nov 18, 2009 at 4:18 a.m. EST
  • Cache 2nd try
    # Turn on Expires and set default expires to 3 days
    ExpiresActive On
    ExpiresDefault A259200
     
    # Set up caching on media files for 1 month
    <FilesMatch "\.(ico|gif|jpg|jpeg|png|flv|pdf|swf|mov|mp3|wmv|ppt)$">
      ExpiresDefault A2419200
      Header append Cache-Control "public"
    </FilesMatch>
    

    copy | embed

    0 comments - tagged in  posted by frankjonen on Nov 10, 2009 at 4:39 p.m. EST
  • Cache images
    <IfModule mod_expires.c>
    ===> btn-send.png
    1  HTTP/1.1 2 Date: Sat, 25 Feb 2006 20:59:28 GMT
    4  Cache-Control max-age=2592000
    5  Expires: Mon, 27 Mar 2006 20:59:28 GMT
    6  Last-Modified: Thu, 16 Feb 2006 12:07:03 GMT
    7  ETag: "b57d55"
    8  Accept-Ranges: bytes
    9  Content-Length: 608
    11 Connection: Keep-Alive
    12 Content-Type: image/png
    </IfModule>
    

    copy | embed

    0 comments - tagged in  posted by frankjonen on Nov 10, 2009 at 4:09 p.m. EST
  • detect iphone
    .htaccess
    
    #redirect mobile browsers
    RewriteCond %{HTTP_USER_AGENT} ^.*iPhone.*$
    RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
    RewriteCond %{HTTP_USER_AGENT} ^.*BlackBerry.*$
    RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
    RewriteCond %{HTTP_USER_AGENT} ^.*Palm.*$
    RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
    
    Javascript
    
    <script language=javascript>
    <!–
    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
    {
    location.replace("iphone-version.html");
    }
    –>
    </script>
    

    copy | embed

    0 comments - tagged in  posted by curosio on Nov 02, 2009 at 3:55 a.m. EST
  • Common .htaccess rules
    # Google Apps redirect
    Redirect 301 /mail http://mail.google.com/a/domain.com
    
    # File execution order
    DirectoryIndex index.php index.html
    
    # Added to prevent directory browsing
    Options -Indexes
    
    # Redirect primary cPanel "domain.com" to a subfolder with same name: /domain.com/
    RewriteEngine on
    RewriteCond %{HTTP_HOST}  ^(www\.)?domain.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/domain.com/
    RewriteRule ^/?(.*)$  /domain.com/$1 [L]
    

    copy | embed

    0 comments - tagged in  posted by fevangelou on Oct 20, 2009 at 2:29 p.m. EDT
  • Compress font files for use with @font-face
    # Compress font files for use with @font-face
    Addtype font/opentype .otf
    Addtype font/truetype .ttf
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css font/opentype font/truetype
    
    # Comments: Both these declarations require their appropriate modules to be active: mod_mime and mod_deflate. And for best practice, the AddType declaration should be in the mime.conf file, and the AddOutputFilterByType declaration should be in the deflate.conf file. See your particular distribution's help files for enabling and configuring Apache modules.
    

    copy | embed

    0 comments - tagged in  posted by fevangelou on Oct 20, 2009 at 10:50 a.m. EDT
Sign up to create your own snipts, or login.