It seems that when the link posts in the WXR file are in the "ugly" permalink format (the default setting, see http://codex.wordpress.org/Using_Permalinks#Default:_.22Ugly.22), importing with alias creation doesn't work.

See this forum post : http://drupal.org/comment/reply/576858/2187408#comment-2187408

I'm not sure if this can be solved because I don't think Drupal path aliases can replicate Wordpress' "ugly" permalink format. This option works better for Wordpress sites that have activated "pretty" permalinks, ie without "p?=" in the URL.

Needs to be investigated...

Comments

lavamind’s picture

milehighlife’s picture

Has anyone successfully used Wordpress Import to alias the ugly permalinks?

lavamind’s picture

This issue is under discussion between the other maintainer and myself.

One solution would be to create a modified alias in Drupal, importing ?p=[id] as something like p/[id], and then a small snippet in Drupal's .htaccess to translate the Wordpress-style ugly permalink into the pretty Drupal alias. That snippet would need to be manually added by the user though, as I simply think it would be unwise for any module to change .htacces

If anyone could think of a better solution, let us know!

yrocq’s picture

I wonder if we should continue to use path aliases to support Wordpress permalinks. A better solution may be to store in a table for each imported post the Wordpress post name, the Wordpress post id and the created node id. This table could be used by a wordpress_import_legacy module that looks for a Wordpress permalink in the path or the query string of the current url and load the matching node if it finds one.

lavamind’s picture

In my view, we should avoid duplicating functionality of Drupal core. What would the benefit be from creating a module like this, exactly?

The case we are looking at here is specifically where the imported Wordpress has "ugly" permalinks (other permalink styles work fine) AND wants to keep the same URLs. Since this case is likely to be the exception rather than the rule, I don't we should go out of our way to create a very specific solution that would also be extra work to maintain...

yrocq’s picture

Using this method would also allow to easily emulate other Wordpress urls like tag/mytag without filling the path alias table. It also offers the advantage of managing clean and ugly url at the same place.

However, I agree that it can represent to much work for a not so useful feature. I think the .htaccess can be a good alternative as long as we just provide a documentation for it and don't try to implement it in the module.

milehighlife’s picture

lavamind,

If I understand you correctly, I would need to create a Drupal-friendly alias (p/[id]) for every ugly URL (?p=[id]) being imported. Then, use .htaccess to rewrite ugly URLs to the alias. I have three different data sets to import into a single Drupal install -- /blog/?p=[id], article.php?id=[id], places.php?placeID=[id] -- and I'm assuming I'd need to create an alias and rewrite rule for each data set?

Thanks.

lavamind’s picture

milehighlife,

Precisely, the creation of the alias would be handled by Wordpress, while the required .htaccess snippet would be documented in the README. That said, the other two link types you mentioned, article.php?id=[id] and places.php?placeID=[id] don't seem like ordinary Wordpress ugly-style permalinks. Are they used by 3rd-party plugins?

lavamind’s picture

Status: Needs work » Fixed

Fix committed in 6.x-2.x-dev.

See new README information for details on how to adjust your .htaccess file.

Anyone care to test this ?

For the record, this page helped me figure our the required Rewrite instructions : http://fantomaster.com/faarticles/rewritingurls.txt

Status: Fixed » Closed (fixed)

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