Results 1 to 4 of 4

Thread: .htaccess 301 redirect of query string URL?

  1. #1
    rickpugh's Avatar
    rickpugh is offline Practically a Glow Sage
    Join Date
    Apr 2005
    Location
    Simi Valley, California, United States
    Posts
    21

    Default .htaccess 301 redirect of query string URL?

    Hey Team,

    Really out of my league on this as I have been reading online but not getting the finer points of everyone's explanations so thought i would post my challenge here and see if anyone can help me....

    1. I had a Joomla site up for over three years. I moved away from Joomla to a Word Press site about two months ago.

    2. My old joomla site had dirty URLs... like this http://www.site.com/index.php?option...=06&Itemid=116.

    3. Now that I have migrated to WP I have clean URLs...

    Having said all of that, I have a ton of 404 errors on the site after the migration that I need to clean up..... The majority are old query string URLs from the old Joomla site. I want to redirect people to the home page of the site if they try to go to any of the old query string URLs.

    First Challenge: The query string URLs I want to redirect were dynamically generated by some of the old Joomla Modules so I need to do a wildcard on the first part of the query string so that anything after the wildcard is also caught with the redirection rule.

    So... here is what I am trying to do:

    Example URL that is getting 404 error: http://www.site.com/index.php?option...=06&Itemid=116

    What I want to catch: http://www.site.com/index.php?option=com_jevents**wild card here ** <-- basically any query string that starts with "?option=com_jevent"

    Where I want to redirect to: http://www.site.com/

    I came up with the following but know it isn't correct as I am getting 500 - Internal Server Error with this one:

    Code:
    # redirect old JEvents Query String URLS to home page
    RewriteCond %{QUERY_STRING} ^?option=com_jevents(.*)$ [NC]
    RewriteRule jevents http://www.www.site.com/ [R=301]
    Anyone know what I did wrong or what would be correct?

    Thanks,
    Rick
    Thanks,

    Rick

  2. #2
    Alexander's Avatar
    Alexander is online now Technical Analyst
    Join Date
    Jul 2007
    Posts
    1,876

    Default

    Hi Rick,
    How did you performed migration? Probably the plugin at WordPress › Joomla/Mambo To WordPress Migrator « WordPress Plugins can help you with it?

  3. #3
    rickpugh's Avatar
    rickpugh is offline Practically a Glow Sage
    Join Date
    Apr 2005
    Location
    Simi Valley, California, United States
    Posts
    21

    Default

    Quote Originally Posted by Alexander View Post
    Hi Rick,
    How did you performed migration? Probably the plugin at WordPress › Joomla/Mambo To WordPress Migrator « WordPress Plugins can help you with it?
    Hey Alex,

    Completely fresh start. No migration done. I completely redeveloped all content (top to bottom).

    When WP site was ready, moved it to Prod and cut off Joomla site.

    Thanks,
    Rick
    Thanks,

    Rick

  4. #4
    GlowAlex is offline Master Glow Jedi
    Join Date
    Sep 2007
    Posts
    188

    Default

    Please try the following code:

    Code:
    # redirect old JEvents Query String URLS to home page
    RewriteBase / 
    RewriteCond %{QUERY_STRING} ^?option=com_jevents(.*)$ [NC] 
    RewriteRule jevents/ http://www.site.com/$1 [R=301]

Similar Threads

  1. PHP MYSQL update query not updating fields
    By pilot911 in forum Programming Talk
    Replies: 2
    Last Post: 03-06-2011, 02:42 PM
  2. MYSQL Query
    By jamison in forum Programming Talk
    Replies: 13
    Last Post: 02-15-2010, 11:50 AM
  3. URL contains string then...
    By rlhanson in forum Programming Talk
    Replies: 2
    Last Post: 12-08-2009, 02:53 PM
  4. [How To] redirect a file to another url
    By Matt in forum Knowledge Base
    Replies: 2
    Last Post: 06-05-2007, 01:08 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14