By phannphong, 1 April, 2025

RedirectMatch\s+301\s+\^?(/[\S]*?)\$?\s+\1\s*$


✅ Match

RedirectMatch 301 ^/example$ /example
RedirectMatch 301 ^/catalogue/vente1150$ /catalogue/vente1150
RedirectMatch 301 /old-path /old-path

❌ Does NOT Match

RedirectMatch 301 ^/example$ /example-def
RedirectMatch 301 ^/old-path$ /new-path
RedirectMatch 301 ^/example/(.*)$ /example-updated/$1
By phannphong, 5 January, 2024

Open the Powershell as Administrator and run this command:

certutil -addstore -f "ROOT" \\wsl.localhost\LINUX_DISTRIBUTION\home\WSL-USER-NAME\.lando\certs\lndo.site.pem

with:

  • LINUX_DISTRIBUTION: your linux distribution, maybe Ubuntu, Ubuntu-20.04, etc.
  • WSL-USER-NAME: your WSL username which is you set when installing WSL.
By phannphong, 15 October, 2023

Your article content type has a dar_start_and_end_date date range field and you want to unpublish all article contents if end value of the date range field is passed.

If your content type uses a date field, you just need to remove .end_value in the coding.

Note: Drupal\Core\Datetime\DrupalDateTime, Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface.

Tags

By phannphong, 16 May, 2022

Find all files in a directory /path/to/directory and its sub-directories recursively:

find /path/to/directory/ -size 0 -type f

or

find /path/to/directory/ -size 0 -type f -print

Extend:

Tags

By phannphong, 17 March, 2019

I will guide you to install Drupal Console with global access permission on your personal computer in 4 steps.

The steps to install Drupal Console is similar to the steps to install Drush 8:

Step 1: Download the latest version of drupal.phar

curl https://drupalconsole.com/installer -L -o drupal.phar

Step 2: Check by running this command line:

php drupal.phar

If everything is fine, you can see the message like the below image:

By phannphong, 17 March, 2019

Following these below steps to install Drush 8 (Ubuntu and MacOS):

The current version of Drush 8 when I writing this article is 8.2.1

1. Choose the latest version of Drush 8 in the below link: 

https://github.com/drush-ops/drush/releases

You can choose v8.2.2 and download the drush.phar. You can use the bellow command line to download it:

wget https://github.com/drush-ops/drush/releases/download/8.2.1/drush.phar

Note: to use the wget command line, you need to install it first.

By phannphong, 21 February, 2019

Drush is a supporting tool, which is important for any Drupal developers. It helps executing a task with many steps simpler through one command. It's also really helpful in deployment process through integrating it in script.

I will share some basic Drush commands that I usually use:

1. Clear cache / Cache rebuild.

For Drupal 7

drush cc all

For Drupal 8/9

drush cr

2. Delete all tables in the database (available on Drupal 7/8/9).