Skip to content

Instantly share code, notes, and snippets.

@j26design
j26design / .htaccess
Created February 23, 2016 16:13
Prevent users from accessing directories with .htaccess
# prevent directory browsing
Options All -Indexes
@j26design
j26design / .htaccess
Last active November 2, 2018 04:11
Redirect subdomain to subfolder
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.subdomain\.example\.com$
RewriteRule ^/?$ "http\:\/\/www\.example\.com\/subdomain\/" [R=301,L]
@j26design
j26design / cpt-genesis.php
Created March 24, 2016 23:26 — forked from neilgee/a-cpt.php
CPT (Custom Post Type) Genesis Theme - Plugin - WordPress Example
<?php
/*
Plugin Name: Event Custom Post Type
Plugin URI: http://wpbeaches.com/create-custom-post-types-in-genesis-child-theme-in-wordpress/
Description: Custom Post Types for Event
Author: Neil Gee
Version:1
Author URI:http://wpbeaches.com
*/
@j26design
j26design / responsive-youtube.js
Created March 31, 2016 08:46
Responsive YouTube videos
// Find all YouTube videos
var $allVideos = $("iframe[src^='//www.youtube.com']"),
// The element that is fluid width
$fluidEl = $("body");
// Figure out and save aspect ratio for each video
$allVideos.each(function() {
$(this)
$('a[href*="//"]:not([href*="'+ location.hostname +'"])').attr('target','_blank');
@j26design
j26design / .htaccess
Created April 11, 2016 19:57
Force .html extension with .htaccess
# This code must be placed in the .htaccess
# file that is located in the root directory
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+?)/?$ /$1.html [L,R=301]