Skip to content

Instantly share code, notes, and snippets.

hansspiess /
Last active May 2, 2020
Create .htaccess files for standard joomla install to secure folders
# Inside the root directory of the Joomla 3 instance, run these commands to add .htaccess files
# to joomla directories (except ./administrator) that prevent direct access to them.
# Also see
# Generally block access from outside
echo "<Files "*.*">
Deny from all
</Files>" > ./bin/.htaccess; cp -i ./bin/.htaccess ./cache/.htaccess; cp -i ./bin/.htaccess ./cli/.htaccess; cp -i ./bin/.htaccess ./includes/.htaccess; cp -i ./bin/.htaccess ./language/.htaccess; cp -i ./bin/.htaccess ./layouts/.htaccess; cp -i ./bin/.htaccess ./libraries/.htaccess; cp -i ./bin/.htaccess ./logs/.htaccess; cp -i ./bin/.htaccess ./tmp/.htaccess
# Block all except media files: First, create .htaccess file with
hansspiess / .htaccess
Created May 1, 2020
Rewrite joomla article urls after turning on new routing system
View .htaccess
# When changing joomla routing to not output article ids, google must be told where those articles are.
# Beware! This breaks if an article slug contains a number!
RewriteRule category\/([a-z]*)\/(\d+)-([^/]*)$1/$3 [R=301,L]
hansspiess / .htaccess
Created Jun 28, 2019
Create a static copy of a phpwcms site
View .htaccess
# Redirect Query String to Html file.
<IfModule mod_rewrite.c>
RewriteCond %{QUERY_STRING} ([a-z0-9]+) [NC]
RewriteRule (.*) /%1.html? [R=301,L]
hansspiess / node, nvm
Created Jun 26, 2018
update node on mac
View node, nvm
# node version manager: list available versions
nvm ls
# nvm: see
# node: get active version
node -v
# activate node version via nvm
nvm use 8
hansspiess / wp-tweaks.php
Last active Dec 14, 2017
wordpress tweaks
View wp-tweaks.php
// remove wp generator
remove_action('wp_head', 'wp_generator');
// disable emojis
function wpt_disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
View wp-config.php
define'ABSPATH', dirname__FILE__ ;
require_onceABSPATH '../path/to/wp-config.php';
hansspiess / mail.php
Last active Feb 25, 2016
Script for sending E-Mails from Localhost for testing purposes. More (german language) at
View mail.php
// get args from command line
if ( defined('STDIN') ) {
$dir = $argv[1] ? $argv[1] : './';
$ext = $argv[2] ? $argv[2] : 'html';
} else {
die( 'not on a local machine.' );
hansspiess / terminal.ini
Last active Oct 30, 2016
useful terminal commands
View terminal.ini
# find all php.ini files on machine from terminal.
mdfind php.ini | grep php.ini
# copy local file to remote machine via scp
scp -P 92 /path/filename.ext
# delete non-empty directory
rm -rf <dirname>
# unzip zip file in current dir
View reinstall-npm.txt
curl -L | sudo sh
hansspiess / Preferences.sublime-settings
Last active Aug 29, 2015
My current Sublime Text 3 User Settings
View Preferences.sublime-settings
"enable_tab_scrolling": true,
// theming & colors
"color_scheme": "Packages/Base16 Color Schemes/base16-ocean.dark.tmTheme",