Skip to content

Instantly share code, notes, and snippets.

View estevecastells's full-sized avatar
😝

Esteve Castells estevecastells

😝
View GitHub Profile
@estevecastells
estevecastells / Force HTTPS only in .htaccess
Last active April 16, 2018 18:24
Force HTTPS only in .htaccess
#Simple Redirect
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
@estevecastells
estevecastells / Force HTTP in PHP
Last active April 16, 2018 18:25
Force HTTP only via .htaccess or PHP
* Redirect WordPress front end https URLs to http without a plugin
* Necessary when running forced SSL in admin and you don't want links to the front end to remain https.
* @link http://blackhillswebworks.com/?p=5088
*/
add_action( 'template_redirect', 'bhww_ssl_template_redirect', 1 );
function bhww_ssl_template_redirect() {
if ( is_ssl() && ! is_admin() ) {
if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
wp_redirect( preg_replace( '|^https://|', 'http://', $_SERVER['REQUEST_URI'] ), 301 );
exit();
@estevecastells
estevecastells / Translate a string via PHP (WordPress)
Created April 16, 2018 18:27
Translate a string via PHP (WordPress)
//Translate string via PHP
add_filter('gettext', 'translate_reply');
add_filter('ngettext', 'translate_reply');
function translate_reply($translated) {
$translated = str_ireplace('String you don't like', 'String you want to have', $translated);
return $translated;
}
@estevecastells
estevecastells / Ahrefs Backlink Profile Bookmarklet
Last active April 27, 2018 19:03
Ahrefs Backlink Profile Bookmarklet
@estevecastells
estevecastells / Ahrefs Top Pages Bookmarklet
Last active April 27, 2018 19:03
Ahrefs Top Pages Bookmarklet
javascript:(function()%7B window.open(%27https://ahrefs.com/positions-explorer/top-pages/v2/subdomains/gb/all/all/all/all/all/all/all/1/traffic_desc?target=%27%2Blocation.host)%7D)()%3B
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^marketingesarte\.com$ [NC]
RewriteRule ^(.*)$ https://estevecastells.com [R=301,L]
RewriteEngine On
RewriteRule ^/?tienda/ http://factoriadejuguetes.com/? [R=301,L]
javascript:(function()%7Bfunction getParameterByName(e%2Ct)%7Be%3De.replace(%2F%5B%5C%5B%5D%2F%2C"%5C%5C%5B").replace(%2F%5B%5C%5D%5D%2F%2C"%5C%5C%5D")%3Bvar n%3Dnew RegExp("%5B%5C%5C%3F%26%5D"%2Be%2B"%3D(%5B%5E%26%23%5D*)")%2Cr%3Dn.exec(t%3D%3Dtrue%3Flocation.hash.replace("%23"%2C"%3F")%3Alocation.search)%3Bif(r%3D%3Dnull%26%26t%3D%3Dfalse)%7Breturn getParameterByName(e%2Ctrue)%7Delse%7Breturn r%3D%3Dnull%3F""%3AdecodeURIComponent(r%5B1%5D.replace(%2F%5C%2B%2Fg%2C" "))%7D%7Dstr%3D"<style type%3D%27text%2Fcss%27>body%7Bcolor%3A%23000%3Bbackground-color%3A%23fff%3Bmargin%3A0%3Bpadding%3A0%3Bfont-family%3Aarial%2Chelvetica%2Csans-serif%3Bfont-size%3A82%25%7D*%7Bfont-weight%3A400%3Bcolor%3A%23000%7Dh3%2Ch4%2Ch5%2Ch6%7Bmargin%3A0 0 15px%3Bpadding%3A0%7D%23rt%7Bfont-size%3A12px%3Bwidth%3A500px%7Dtable%2Ctd%2Cth%2Ctr%7Bfont-size%3A1em%3Boverflow%3Ahidden%3Btext-overflow%3Aellipsis%3Bword-wrap%3Abreak-word%7Dtextarea%7Bwidth%3A100%25%7Dth%7Bbackground-color%3A%23eee%3Bcolor%3A%23000%3Bfont-weight%3A700%7Dtd a%7Bwidt
i
me
my
myself
we
our
ours
ourselves
you
your
2 girls 1 cup
2g1c
4r5e
5h1t
5hit
5ht
666
@$$
a s s
a s shole