Citat:
dbaja kaže:
RewriteRule ^kontakt\.php\?lang\=(sr|en)$ /index.php?lang=$1#CONTACT [NE,R]
|
Ne mozes ovako da pises RewriteRule, jer se ono odnosi samo na deo do pocetka query stringa.
Citat:
Apache mod rewrite dokumentacija kaže:
The Pattern is a regular expression. It is initially (for the first rewrite rule or until a substitution occurs) matched against the URL-path of the incoming request (the part after the hostname but before any question mark indicating the beginning of a query string) or, in per-directory context, against the request's path relative to the directory for which the rule is defined.
|
Dakle ako hoces da match-ujes query string, moras da koristis:
Kod:
RewriteCond %{QUERY_STRING}
Druga bitna stvar ovde je:
Citat:
By default, the query string is passed through unchanged.
|
Znaci, ako koristis samo:
Kod:
RewriteRule ^kontakt\.php$ /index.php#CONTACT [NE,R=301]
kontakt.php -> index.php#CONTACT
kontakt.php?lang=sr -> index.php?lang=sr#CONTACT
kontakt.php?lang=en -> index.php?lang=en#CONTACT
kontakt.php?lang=en&foo=bar -> index.php?lang=en&foo=bar#CONTACT
NE (no escape) flag ti treba zbog "#" karaktera.