I'm moving our civi from Joomla to Wordpress and as a part of the process I wanted to set up some redirects for our existing PCP pages. As you all know civi URLs are kind of long: baseurl.com/sub_dir/index.php/component/civicrm/?task=civicrm/pcp/info&reset=1&id=XX

I've found several posts explaining query string redirects like this one (http://simonecarletti.com/blog/2009/01/apache-query-string-redirects/) but in all of them their variable is right after the "?". I have tried the following to no avail:

RewriteEngine on
RewriteCond %{QUERY_STRING} task=civicrm/pcp/info&reset=1&id=20$
RewriteRule ^sub_dir/index\.php/component/civicrm/$ /path-to-new-location/? [L,R=301]

Eventually, I do want to write it with variables (as we have several hundred PCPs but I wanted to get something working first.) Any help is greatly appreciated!!!

  • I'm voting to close this question as off-topic because it's about Apache, not CiviCRM. I think you'll get better answers on webmasters.stackexchange.com or stackoverflow.com. Jun 25 '15 at 20:43
  • I've scoured those sites a bit and have struggled to find an appropriate solution, I just thought someone in the civi world would have done something similar before. Wasn't trying to break the rules.
    – RayWright
    Jun 25 '15 at 20:46

Apparently my above code was correct, save for I was putting it in our main directory's htaccess file. Once placed in the subdirectory's file (and "sub_dir" removed) all is right!


I'm not a Joomla person, but Drupal has a "URL Aliases" module that lets you do redirects from within Drupal. It looks like Joomla has something similar.

  • So it does, never knew that existed. Unfortunately, I most likely won't be able to keep the old install up when the new Wordpress site is live. But I did test it and it does not seem to be playing nice - perhaps that means I have a bigger issue. I will continue to read on the redirect manager in the case it does present a viable solution, thank you.
    – RayWright
    Jun 25 '15 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.