RedirectMatch to home page?

Hi, I have some 404s like:

http://www.abbeycarefoundation.com/hab.php?d=485
http://www.abbeycarefoundation.com/hab.php?d=486
http://www.abbeycarefoundation.com/hab.php?d=487

…so I’m trying to redirect all of them to the homepage using Redirect Match

For (eg) http://www.abbeycarefoundation.com/hab.php?d=485

…my statement:

RedirectMatch 301 ^/hab.php(.*)$ http://www.abbeycarefoundation.com/

…results in redirecting to

http://www.abbeycarefoundation.com/?d=485

rather than just http://www.abbeycarefoundation.com/

…which is what I’d prefer.

Can anyone guide me pls on how to tweak the statement so that it points to jist the homepage url, without any parameters added to the url?

Thanks :slight_smile:

I haven’t tested this, but try adding a “?” at the end of the redirect URL.

[FONT=Courier New]RedirectMatch 301 ^/hab.php(.*)$ http://www.abbeycarefoundation.com/[SIZE=5][COLOR=“#FF0000”]?[/COLOR][/SIZE][/FONT]

If we were using rewrite rules, that would do the trick, so I’m hoping RedirectMatch works the same way.

hi, thanks for this, this redirects me to url

http://www.abbeycarefoundation.com/?

All I need now is to get rid of the question mark…any advice appreciated on this

Many thanks :slight_smile:

Gotcha. Looks like you’ll have to switch to RewriteRule instead of RedirectMatch. Try…

[FONT=Courier New]RewriteEngine On

RewriteRule ^/?hab\.php$ http://www.abbeycarefoundation.com/? [R=301,L][/FONT]

Thanks Jeff, adding this to htaccess seems to just take me back to the 404 page. Hmmm. Maybe I should try a plugin? Thanks again for your help. :slight_smile: