Redirection

Zyxware default image2
| 1 min read
Consider a case where you want to enter regular expression and validate it. Here I will show you how to write a validation function. For example consider YOURMODULE_admin_settings_validate function In my example I am using a form and a submit button.From $form_state array you can get the input value after submit. You need this value to match with the string. See the code below.
Zyxware default image3
| 3 min read
In this article I am going to tell you how to redirect anonymous users to a login form on 403 access denied pages in Drupal. There are some contributed module that provides you this feature but, if you really want to create a custom one for your site just try this. Here I will show you a PHP snippet that redirecting to login page for anonymous users on access denied.
Zyxware default image2
| 3 min read
In a common secnario if a user types the url of a Drupal based website without the 'www'.prefix they will be automatically redirected to the  required site with the complete url. This is very convenient for most web users who do not want to type in the obvious 'www' prefix. Webmasters can configure this by changing the settings of the Drupal .htaccess file. However this will  be a problem if the Drupal site has a mobile version with an 'm.' prefix. Users wishing to access the mobile version of that Drupal site will inevitably be redirected to the main website.