Search code examples
.htaccesshttp-status-code-301

RedirectMatch 301 Wildcards Without Variables at the End


How do You do a re-direct a group of pages with a wildcard that doesn't attach the variables at the end? For example, the .htaccess code below:

RedirectMatch 301 /general/old_events_page.php(.*) http://mysite.org/events

Yields this:

mysite.org/events?id=749&friendly=1&date=20090308

But I just want it to go to http://mysite.org/events


Solution

  • Try this mod_rewrite rule:

    RewriteEngine on
    RewriteRule ^general/old_events_page\.php$ /events? [L,R=301]