nerd afdelingnerd afdeling

Redirect http://www to https:// and http:// to https://

To redirect http://www to https:// and http:// to https:// add the following to your .htaccess file.

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
  # Redirect to https
  RewriteCond %{HTTPS} !=on
  RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]

Tags htaccess
Show feature conflicts in Drupal

When you have a conflict between 2 or more features and you don't know why you can check the conflicts by entering the code below in devel/php

Tags php, Drupal, code
Fix drupal form states on multiple select fields

Use this behavior when you want to apply form states to a multiple select field.

  Drupal.behaviors.optAdd = {
How to disable Drupal 7's admin overlay for certain paths

Add this piece off code to your custom module to disable the admin overlay on certain pages

Tags Drupal, php
Count query (Drupal 7)


Replace Drupal date popup with an HTML5 date input element

The following code can be used to replace Drupal's jQUery UI Datepicker with an HTML5 date input element for iOS devices. This way the iOS' native date picker will be used instead of the date popup.

Tags JavaScript, jQuery, iOS, HTML5
Remember last clicked item on pager

function custom_module_views_pre_execute(&$view) {
Tags Drupal, code, views
Pretty formats GIT logs

If the commit is a merge, and if the pretty-format
is not 'oneline', 'email' or 'raw', an additional line is
inserted before the 'Author:' line.  This line begins with
"Merge: " and the sha1s of ancestral commits are printed,
separated by spaces.  Note that the listed commits may not
necessarily be the list of the *direct* parent commits if you
Import database in the terminal

mysql -u USERNAME -p --default-character-set=utf8 DATABASENAME < PATH_TO_MYSQL_DUMP

Tags MySQL, Database, terminal, command line