I have created 7 URL aliases without any problem. But when I tried to make an alias for system path "user/login" as "login", I got error message:

The path 'user/login' is either invalid or you do not have access to it.

What confuses me most is the example of URL aliases is saying like below:

Some examples of URL aliases are:

* user/login => login
* image/tid/16 => store
* taxonomy/term/7+19+20+21 => store/products/whirlygigs
* node/3 => contact

I am sure there is nothing wrong with the permission as I could create 7 of other aliases, and they are working fine. So what could be the reason?

Comments

aryanto’s picture

I just added the URL alias directly into url_alias table in MySQL, and it works alright. I added src=/user/login and dst=login on the new pid.

But I don't think this is the solution as there might be other issues related to this.

nunami’s picture

I am also unable to create an alias for user/login. I'm surprised as it's mentioned in the 'getting started' documentation.

Aside from directly modifying the table, is there a fix to this problem?

mr.baileys’s picture

The user/login path is only accessible to anonymous users:

  $items['user/login'] = array(
    'title' => 'Log in',
    'access callback' => 'user_is_anonymous',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );

Once you're logged in, you are no longer authorized to access the user/login page...

This explains why it works when you add it to the table manually: you're bypassing the access check that happens when you enter URL aliases through the interface. I agree that it's an unfortunate example in the "Getting Started" guide.

mr.baileys’s picture

Version: 6.1 » 7.x-dev
Status: Active » Needs review
StatusFileSize
new917 bytes

I think the administrator should be able to insert aliases for all URLs (if they exist), even if he/she does not have access to the URL. The user/login path is a fine example: because the administrator fails the "user_is_anonymous" access check, it's impossible to set up an alias for it.

Attached is an attempt to fix this, by ignoring the access check if the user is the superadmin.

mr.baileys’s picture

StatusFileSize
new934 bytes

Improved the check for administrator.

chx’s picture

Status: Needs review » Closed (duplicate)

#190867: Remove access check for anonymous users when creating aliases recently a patch blocking that has been uncovered so work now can commence.

negative_zero’s picture