RedirectMatch to home page?

Hi, I have some 404s like:

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

For (eg)

…my statement:

RedirectMatch 301 ^/hab.php(.*)$

…results in redirecting to

rather than just

…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(.*)$[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

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$ [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: