Add conditional stylesheet to URL alias I am attempting to add a conditional stylesheet to my user registration form which has an alias called "signup"

This is the code I am using, however this does not seem to work.  I have tried loads of other different ways but I cannot seem to find any clear documentation on how to do this.

Any ideas on this?  The simpoer the better, my code seems to be quite complex for something so simple.

Thanks

function mytheme_preprocess_page(&amp;$variables, $hook) {
$matches = "signup";
$path = drupal_get_path_alias($_GET['q']);
$page_match = drupal_match_path($path, $matches);
if ($path != $_GET['q']) {
$page_match = $page_match || drupal_match_path($_GET['q'], $matches);
}
if ($page_match) {
drupal_add_css(drupal_get_path('theme', 'mytheme') . '/style.css');
}


Also tried this to no avail

function mytheme_form_alter(&amp;$form, &amp;$form_state, $form_id) {
global $user, $theme;
switch ($form_id) {
    case 'user/register':
      $form['#attached']['css'] = array(
        drupal_get_path('theme', 'mytheme') . '/css/new.css',
      );
    break;
 }
You're right, that is overly complex. 

First of all, make sure your mytheme_preprocess_page() function is actually getting called by adding print &amp; then exit statements. If it's not getting called, clear your theme registry by clearing the site's cache. 

Once you're sure the preprocessing function is getting called, this will do the trick for you:

if (preg_match('#user/register#', $_GET['q'])) {
  drupal_add_css(drupal_get_path('theme', 'mytheme') . '/style.css');
}


$_GET['q'] always contains the 'internal' Drupal path, not the alias. The internal path for the normal registration form is user/register, so that's what you want to check for.