Skip to main content
3 of 4
Formatting, clarified wording
MrWhite
  • 43.1k
  • 4
  • 50
  • 90

How to match only part of URL and redirect URL with parameters in .htaccess?

I have a number of links with similar structure:

example.com/index.php/path/some-path/some-subpath?parameter=1

Which I want to redirect just to example.com/category/

But I want to match only the URL-path, ie. /index.php/path/some-path/some-subpath, because the query parameter is irrelevant.

I have tried the following rule:

RewriteRule ^/index.php/path/some-path/some-subpath?parameter=\dd\? /category/ [L,R=301]
Alan Kis
  • 247
  • 2
  • 4
  • 11