After migrating from Drupal to wordpress links to event info pages for example no longer work - as these have been shared already is there a way to redirect these?
2 Answers
You can keep the URLs you're currently using - as long as you're using a recent version of CiviCRM - simply by adding this to your wp-config.php
file:
define( 'CIVICRM_CLEANURL', 1 );
This will create URLs in the same format as Drupal ones, i.e.
https://domain.com/civicrm/event/info?reset=1&id=3
This does assume that you are using the default base page named "CiviCRM" with the slug civicrm
. If this page doesn't exist, then create it and add the slug to the setting in the CiviCRM "CMS Database Integration" admin page. You may also need to visit the WordPress "Permalinks" page to refresh your rewrite rules so that Clean URLs work as expected.
-
I forgot to add: if you're having issues with refreshing rewrite rules, apply this patch to the WordPress plugin: github.com/civicrm/civicrm-wordpress/commit/… Commented Jun 19, 2019 at 8:30
Using nginx it's possible to catch these links and redirect:
In the relevant server block add a location match on /civicrm/event/info
then redirect this to https://$server_name/?page=CiviCRM&q=civicrm%2Fevent%2Finfo&reset=1&$args
So it will look like this:
location /civicrm/event/info {
return 301 https://$server_name/?page=CiviCRM&q=civicrm%2Fevent%2Finfo&reset=1&$args;
}
By comparing other urls you can catch contribution pages and others as well.