ich hab da mal wieder ne frage zu mod_rewrite...
geht sowas:
mod_rewrite soll aus www.domain.de/en/datei.php?var1=inhalt1 das machen: www.domain.de/v6/datei.php?var1=inhalt1&lang=en
wenn ja wie? *verzweifel*

mfg dennis
RewriteRule ^([a-zA-Z]{2})/(.*\.php{1})(.*)$ v6/$2$3&lang=$1
KingCrunch wrote:
- Code: Select all
RewriteRule ^([a-zA-Z]{2})/(.*\.php{1})(.*)$ v6/$2$3&lang=$1
Ist jetzt ungeprüft und zumindest wie folgt gemeint:
Apache Manual wrote:The Pattern will not be matched against the query string. Instead, you must use a RewriteCond with the %{QUERY_STRING} variable. You can, however, create URLs in the substitution string, containing a query string part. Simply use a question mark inside the substitution string, to indicate that the following text should be re-injected into the query string. When you want to erase an existing query string, end the substitution string with just a question mark. To combine a new query string with an old one, use the [QSA] flag.
RewriteRule ^/([a-zA-Z]{2})/(.*\.php)$ /v6/$2?lang=$1 [QSA]
# Für PHP Dateien die Variable lang & Querystringmit übergeben
RewriteRule ^en/(.*\.php)$ /v6/$1?lang=en& [QSA]
# Für alle anderen nix, ausser evtl. den Query String
RewriteRule ^en/(.*)$ /test/go/$1? [QSA]
RewriteRule ^de/(.*\.php)$ /v6/$1?lang=de& [QSA]
RewriteRule ^de/(.*)$ /test/go/$1? [QSA]
RewriteRule ^cz/(.*\.php)$ /v6/$1?lang=cz& [QSA]
RewriteRule ^cz/(.*)$ /test/go/$1? [QSA]
Users browsing this forum: No registered users and 6 guests