Url mapping from custom CMS to Drupal We migrated a site from custom CMS to Drupal. The content has been migrated successfully, but there is a problem with URL mapping.

In old site the URLs were like domain.com/artists/Artist_ID/Artist_Name (e.g. domain.com/artists/5/picasso), where the URL would work without the last argument part (picasso).

With the Drupal site all URLs use domain.com/artists/Artist_ID as format (e.g. domain.com/artists/5).

They have shared the old site's links on social media where URLs are like domain.com/artists/5/fabien-m%25C3%25A9relle which used to work fine in the old site because last part didn't matter. The same URLs do not work on the Drupal site. 

So can I make Drupal ignore the last part of the URL?
You can use Apache's mod_rewrite to map all the old URLs shared on social media sites into appropriate new ones, including ignoring the latter part.  However, Drupal 7 have a quirk.  You need to rewrite to unclean URLs for it to work.

So first, turn off clean URLs (which also means turning off PathAuto) on your site.  Then look up one of your artist's pages and figure out what the real URL is.  Let's say that for artist 5 (Fabien Mérelle), it is:

domain.com/?q=taxonomy/term/5


Now you should be able to insert the following rewriterule:

RewriteRule ^artists/([0-9]+)/.*$ ?q=taxonomy/term/$1


(You must of course change the target to whatever your test showed the true query string to be.)

The above rule will change artists/5/fabien-m%25C3%25A9relle into ?q=taxonomy/term/5.

Verify that that the rule "works" (i.e. that the URL is really rewritten).  Then you should be able to turn clean URLs and PathAuto back on, and it should still work.

The rule consists of two parts.  The first (^artists/([0-9]+)/.*$) is the pattern to look for, the second (?q=taxonomy/term/$1) is the target.  They're separated by a single space.

The ^ in the pattern indicate the start of the local path, so it looks for a pattern starting with artists/ followed by a number ([0-9+]) followed by a slash (/) followed by anything (.*).  The final $ in the pattern is just a marker for the end of the local path. The parentheses around the number stuffs the number into the variable $1.  The target simply consists of the static string ?q=taxonomy/term/, followed by the value of the $1 variable.

Note: You must place the line with the rewriterule inside the .htaccess file for the site, inside the block that starts with:

# Various rewrite rules.
&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine on