Re: rewriting URLs, part II -- 301 redirect from old dynamic URLs



"web_design" <web_design@xxxxxxxxxxxxxxxxx> wrote in message
news:11epst1rufq351@xxxxxxxxxxxxxxxxxxxxx
>> -----------------------------------------------------------------------
>> # This part works:
>> RewriteEngine On
>> RewriteRule ^(.+)(\.htm)$ /index.php?p=$1 [L]
>>
>> # This is the part that doesn't work:
>> RedirectMatch 301 /index.php?p=(.*)$ http://www.mywebsite1234.com$1.htm
> -------------------------------------------------------------------------------------
> I'm wondering:
>
> Is the [L] a problem?
> Should the ? in the RedirectMatch be escaped by a backslash?
> Do I need an [R] somewhere?
> Do I need to escape all my periods with backslashes?
>
> I'm experimenting with these but haven't had any luck yet. I also added a
> forward slash, which was recommended to me, so it looks like this now:
> RedirectMatch 301 /index.php?p=(.*)$ http://www.mywebsite1234.com/$1.htm

Through a lot of experimentation I've narrowed the problem down to this one
part:
/index.php?p=(.*)$

I know this because I've tried regular redirects without success, for
example:
RedirectMatch 301 /index.php?p=(.*)$ http://www.anysite.com
Redirect 301 /index.php?p=page1 http://www.anysite.com

and it doesn't work. But this works:
Redirect 301 / http://www.anysite.com



.



Relevant Pages