Environment:
- Drupal 6.10
- Pathauto 6.x-1.1 with "Create a new alias. Redirect from old alias." Update Action enabled
- Path Redirect 6.x-1.x-dev

When editing a node, unchecking the "Automatic alias" box and manually entering a URL fails to create a 301 redirect from the original URL to the new one.

Comments

todd nienkerk’s picture

This bug has also been verified using Pathauto 6.x-2.x-dev.

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

Can you still confirm the problem with latest pathauto and 6.x-1.x path_redirect?

luti’s picture

Drupal 6.10 ???

todd nienkerk’s picture

LUTi: Sorry -- that's a typo. I must've been thinking of whatever Drupal 5.x release was out at the time. When I posted this issue, I was using the most recent stable 6.x release available.

Dave Reid: I tried installing the latest 6.x-1.x-dev release of path_redirect. When I ran update.php, I got this error:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'small) NOT NULL' at line 1 query: ALTER TABLE path_redirect CHANGE type `type` INT(small) NOT NULL in /Users/todd/Sites/drupal6/includes/database.mysql-common.inc on line 520.

[...]

The following queries were executed
path_redirect module
Update #5100

* ALTER TABLE {path_redirect} CHANGE rid `rid` INT NOT NULL auto_increment
* ALTER TABLE {path_redirect} CHANGE query `query` VARCHAR(255) DEFAULT NULL
* ALTER TABLE {path_redirect} CHANGE fragment `fragment` VARCHAR(50) DEFAULT NULL
* Failed: ALTER TABLE {path_redirect} CHANGE type `type` INT(small) NOT NULL

dave reid’s picture

@Todd: That was a small typo in an update function (see #365555: Failed: ALTER TABLE {path_redirect} CHANGE type `type` INT(small) NOT NULL) which has already been fixed. How about the original problem? Are you still having it?

todd nienkerk’s picture

Dave Reid: Just for kicks, I tried installing 6.x-1.0-beta1 on top of the dev snapshot. As you can probably guess, I got errors galore. I've included them here just in case they're helpful. They're probably not, though, because moving from a snapshot to a supported release isn't typical behavior.

* warning: Invalid argument supplied for foreach() in /Users/todd/Sites/drupal6/includes/database.mysql-common.inc on line 109.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 ()' at line 1 query: ALTER TABLE path_redirect CHANGE redirect `redirect` VARCHAR(255) NOT NULL, ADD UNIQUE KEY 0 () in /Users/todd/Sites/drupal6/includes/database.mysql-common.inc on line 520.
* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE path_redirect DROP PRIMARY KEY in /Users/todd/Sites/drupal6/includes/database.mysql-common.inc on line 386.
* user warning: Can't DROP 'rid'; check that column/key exists query: ALTER TABLE path_redirect DROP KEY rid in /Users/todd/Sites/drupal6/includes/database.mysql-common.inc on line 417.
* user warning: Multiple primary key defined query: ALTER TABLE path_redirect ADD PRIMARY KEY (rid) in /Users/todd/Sites/drupal6/includes/database.mysql-common.inc on line 374.
* user warning: Duplicate key name 'path' query: ALTER TABLE path_redirect ADD UNIQUE KEY path (path) in /Users/todd/Sites/drupal6/includes/database.mysql-common.inc on line 403.

[...]

The following queries were executed
path_redirect module
Update #1

* ALTER TABLE {path_redirect} CHANGE path `path` VARCHAR(255) NOT NULL
* Failed: ALTER TABLE {path_redirect} CHANGE redirect `redirect` VARCHAR(255) NOT NULL, ADD UNIQUE KEY 0 ()

Update #2

* ALTER TABLE {path_redirect} CHANGE type `type` SMALLINT NOT NULL

Update #3

* UPDATE {path_redirect} SET type = 307 WHERE type = 306

Update #4

* ALTER TABLE {path_redirect} CHANGE query `query` VARCHAR(255) DEFAULT NULL
* Failed: ALTER TABLE {path_redirect} DROP PRIMARY KEY
* Failed: ALTER TABLE {path_redirect} DROP KEY rid
* Failed: ALTER TABLE {path_redirect} ADD PRIMARY KEY (rid)
* Failed: ALTER TABLE {path_redirect} ADD UNIQUE KEY path (path)

todd nienkerk’s picture

@ Dave Reid re: #5: I uninstalled and reinstalled Path Redirect 6.x-1.0-beta1. I am still experiencing the problem I originally reported. Here's the new environment:

- Drupal 6.9
- Pathauto 6.x-1.1 with "Create a new alias. Redirect from old alias." Update Action enabled
- Path Redirect 6.x-1.0-beta1

When I uncheck the "Automatic alias" box and manually enter a new alias, the old alias disappears from the URL aliases list (Pathauto's behavior), but Path Redirect fails to create a 301 redirect. No redirects are listed at /admin/build/path-redirect.

todd nienkerk’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta1

Switching issue to the appropriate version.

dave reid’s picture

@Todd: The errors in #6 are very weird, because it's running all the update functions, even though there should have only been one update to run. In that case I would recommend uninstalling and re-installing like you have done, so you can start with a clean slate. I'll test the 6.x -> 6.x updates on one of my sites. Could I bother you to try the Pathauto 6.x-1.x version?

todd nienkerk’s picture

@Dave Reid: Always happy to help. Unfortunately, updating Pathauto 6.x-1.x does not solve the problem. Same behavior described above.

dave reid’s picture

Title: Manually changing "URL path settings" field for a node fails to create 301 redirect » Pathauto integration not working
Version: 6.x-1.0-beta1 » 6.x-1.x-dev
Assigned: Unassigned » dave reid
Status: Postponed (maintainer needs more info) » Active

Ok yeah I'm having problems with it too. I'm looking into it and will post results and progress back here.

dave reid’s picture

Pathauto integration has been fixed in 6.x-1.x (I even wrote a test case to make sure it is working). I'm also working with greggles to update pathauto to use the updated and proper path_redirect API. The issue in pathauto is #365992: Update integration with path_redirect.

BTW, if you uncheck the 'automatically create path alias' checkbox used by pathauto, the pathauto module cannot create an automatic redirect since it's no longer in control of the alias.

dave reid’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.