Skip to content

Instantly share code, notes, and snippets.

View dchatry's full-sized avatar

Damien Chatry dchatry

View GitHub Profile
@dchatry
dchatry / .htaccess
Last active November 5, 2015 14:57
[Drupal] Clean URL for files
# Clean URL for files in Drupal
#
# Replace : http://www.site.com/sites/default/files/myfile.txt
# by : http://www.site.com/files/myfile.txt
# Be careful to put this rule before any other blocking rule.
RewriteRule ^files/(.*)$ /sites/default/files/$1 [L]
@dchatry
dchatry / redirect_from_node.php
Last active November 5, 2015 14:57
[Drupal] Redirection inside a node
function MODULE_node_view($node, $view_mode, $langcode) {
if ($view_mode == 'full' && node_is_page($node)) {
//It is safe to call drupal_goto() from here
}
}
@dchatry
dchatry / run_task.php
Last active November 5, 2015 14:57
[Rules scheduler] Run a specific task
$task = rules_scheduler_task_load([tid]);
rules_scheduler_run_task($task);