0

I'm trying to configure the rewrite rules for my application, my requirement are

  1. /aaa/bbb/ccc/ddd/ -> ./index.php?aaa=$1&bbb=$2&ccc=$3&ddd=$4
  2. /aaa/bbb/ccc/ddd -> ./index.php?aaa=$1&bbb=$2&ccc=$3&ddd=$4
  3. /aaa/bbb/ccc/ -> ./index.php?aaa=$1&bbb=$2&ccc=$3&ddd=
  4. /aaa/bbb/ccc -> ./index.php?aaa=$1&bbb=$2&ccc=$3&ddd=

With the rule only the URL no. 1 & 2 are working, but no. 3 & 4 are not working, may someone can help to correct the rule, thanks in advance!

RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)(/?)(.*?)$ ./index.php?aaa=$1&bbb=$2&ccc=$3&ddd=$4 [L]
Romeo Ninov
  • 5,932
  • 4
  • 20
  • 26
TOM
  • 1
  • RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)(/)?([a-zA-Z0-9_-]+)?(/)?(.*)?$ ./index.php?aaa=$1&bbb=$2&ccc=$4&ddd=$6 [L] – TOM Jun 29 '23 at 06:02

0 Answers0