[thelist] Rewrite using htaccess

Phil Turmel philip at turmel.org
Tue Jun 21 20:49:00 CDT 2011

Hi Todd,

On 06/21/2011 05:04 PM, Todd Richards wrote:
> Hi Everyone -
> I just moved a site from classic ASP to a PHP based system
> (ExpressionEngine).  I've got most of my old pages set up with a 301
> redirect and they are working fine.  However, I've got a few old ASP pages
> that used a querystring.  
> Ex: calendar.asp?m=04 (for April) or gallery.asp?category=20
> For the first one, I want to just direct it to the calendar page which
> displays all of the latest events.  So the new URL would be
> http://www.site.com/index.php/calendar/.  However, the best I can get is
> http://www.site.com/index.php/calendar/?04, which is invalid and then
> redirects to the 404 page.
> This has gotten me the closest so far:  
> RewriteCond %{QUERY_STRING} m=
> RewriteRule (.*) http://www.site.com/index.php/calendar/ [L,R=301]

Try it with just the following rule (omit RewriteCond):

RewriteRule calendar.asp http://www.site.com/index.php/calendar/? [L,R=301]

> I would be forever grateful for any adjustments that would get this working.

See the note for "Modifying the Query String" under the RewriteRule documentation:




More information about the thelist mailing list