Need help with htaccess redirect

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I've got Googlebot looking for asp files in a wordpress blog.  

What I'm doing now is:

RedirectMatch (.*)\.asp$ $1.asp

This is working for the wordpress site, but not quite when it gets to the
other site.  A request could come for
and it is going to - but foo/baz/
does not exist, only file.asp, and it's in the root (Windows server).  So
I'm getting a 404 on the other end.  

I'm not an Apache person, and I break out in hives when I see a regular
expression (this must come from fearing "word problems" in grade school).  
Please don't ask how I got into this mess, just suffice to say it's a
long story.

What I need to do is say, if you're looking for an asp file, then you
need to go that at the root of , and take your
parameters with you.

I would greatly appreciate any help y'all could give me.  TIA.

Adrienne Boswell
Arbpen Web Site Design Services - /
The Good Plate - Fresh Gourmet Recipes - /
Please respond to the group so others can share

Re: Need help with htaccess redirect

Quoted text here. Click to load it


Quoted text here. Click to load it


RedirectMatch ([^/]+\.asp)$ /$1

Means: capture everything that's not a / (^/ means not, and [] = match
any of the characters between the []), followed by a dot, followed by
asp at the end, and redirect to the captured part (on

Quoted text here. Click to load it

Somehow I can still post via Individual :-).

BTW Check your messages on Facebook ;-).

John Bokma                                                               j3b

Blog:        Perl Consultancy:
Perl for books:

Re: Need help with htaccess redirect

On Monday, November 28, 2011 3:48:54 PM UTC-5, John Bokma wrote:
Quoted text here. Click to load it

If I understand what you're doing correctly, then you don't need the $1. The $1
matches whatever is in the (.*), which is going to be foo/baz (or maybe
/foo/baz/; might want to look at REQUEST_URI to see how the server is getting

When you say that you want to send the parameters, do you mean the QUERY_STRING,
or that you want to preserve /foo/baz/ somewhere? To preserve the QUERY_STRING,
add [QSA] to the end of the line. Like:

RewriteRule ^/(.*)\.asp [QSA]

If you want file.asp to recognize /foo/baz/ as a variable, do this:

RewriteRule ^/(.*)\.asp =$1 [QSA]

This would send to:

(I'm not 100% on the preservation of the backslashes there, but I think this is

Site Timeline