Force HTTPS/SSL and WWW (Works with Sub-directory URLs)

This tiny bit of code will make your website use HTTPS and also WWW in the URL and it also work if they request subdir and/or anyfile in the URL.

First, you’ll take a backup of your current “.htaccess-file” if you have one. Because it isn’t guaranteed that this will work on the server you’re using.

Place this bit of code in a file called “.htaccess” in your website WWW-root directory.

RewriteEngine on
# Force www
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# Force SSL
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,NE]

That’s everything that is needed. Save and upload.

Make sure you try your website out and that HTTP also will become HTTPS when you want to access something in a sub-directory.

Use uniq. Passwords for all sites – Just 1 MasterPass to remember!

All these password on sites, it’s starting to become a real mess. At least for me, I do use Lastpass but I don’t really trust them to 100%.

You should NEVER, EVER use the same passwords on several sites, not ever 2 sites.
But there’s a really great Bookmarklet (Basically a normal bookmark with Jvascript) that can help you to create a unique password that you don’t have to remember for every new domain, just enter your master password and it will fill out the form for you.
This goes for both when you register a account and when you want to login to that site. You can use a different password for each website if you cant to too, but keep in mind that you must remember your master password(s).


The first basic version is here: Try thing one out first!

Here is a version with a bit of extra features:

And here is another version of the first script but you dont have to enter any masterpassword because it’s already in the Bookmarklets code:

Do not let other people have access to your computer and dont trust super important sites with any of these methods unless you’ll find them safe enough:

Masterpass in Bookmarklet code

Delete duplicates in Notepad++ without plugin! (64 and 32 bit!)

Notepad++ is a great application and it’s free too. It got tones of features but I wonder why they didn’t include a feature so you can remove duplicate lines without installing extra plugins like TextFX.

But TextFX doesn’t work on NotePad++ 64-bit, but there is a way to delete duplicate lines/rows without TextFX or any other plugin. And it works with both 32 and 64 bit.

1: In Notepad++, click on “Search” and then on “Replace…”

This search and replace tool window will show up.

2: Click on the tab named “Replace”.

In the “Find what”-field, put this in:

The “Replace with” field should be empty!

3: Select “Regular Expression” and also “.matches newline” as you can see in the picture.

Click on “Replace All” and the duplicates in Notepad++ have been removed without TextFX! Credits and thanks to for this trick!

PHP code: Permalink/URL to the latest/newest post in WordPress.

Here’s a little useful sample to get a link to the newest(latest, freshest… you get the idea) post in WordPress.

Here is the tiny but useful bit of code:

$latest = get_posts(array('numberposts' => 1));
$url = get_permalink($latest[0]->ID);
echo "<a href='" . $url . "'>Click here and read our latest post!</a>";

Yeah, that’s it. Have a great day!