-1

I have 3 step in one php file: This is my htacess now:

RewriteRule ^igra/(.*)$                         "/index.php?page=igra&id=$1"
RewriteRule ^igra/(.*)/sezona/(.*)$                         "/index.php?page=igra&id=$1&season=$2"
RewriteRule ^igra/(.*)/sezona/(.*)/liga/(.*)$                         "/index.php?page=igra&id=$1&season=$2&league=$3"

When i go in browser something like index.php?page=igra&id=$1 or index.php?page=igra&id=$1&season=$2 or index.php?page=igra&id=$1&season=$2&league=$3 sure with real values it works fine, but when i try to access with this pretty links it always show me the first rewrite rule..

I hope u understand me what i need here, best regards..

1 Answers1

1

Your first rule is capturing everything, so the subsequent rules never get executed. Just switch them around:

RewriteRule ^igra/(.*)/sezona/(.*)/liga/(.*)$ /index.php?page=igra&id=$1&season=$2&league=$3 [L]
RewriteRule ^igra/(.*)/sezona/(.*)$           /index.php?page=igra&id=$1&season=$2 [L]
RewriteRule ^igra/(.*)$                       /index.php?page=igra&id=$1 [L]

Notice also the addition of the L flag.

BenM
  • 52,573
  • 26
  • 113
  • 168