I'm trying to backreference a cookie's value in a RewriteRule
:
# Trace rewrite rules log
LogLevel alert rewrite:trace4
# Rewriting the URL, in the cookie's condition i've tried en alone, and en|fl|nl without sucess
RewriteCond %{REQUEST_URI} !redirect-lang
RewriteCond %{HTTP_COOKIE} !lang=(fr|en|nl)
RewriteRule ^(.*)$ /redirect-lang/%1$1 [R=301,L]
# Test if cookie exist then create it if not
SetEnvIf Cookie "lang=(.*)" HAVE_locale=
Header set Set-Cookie "lang=fr; path=/;" env=!HAVE_locale
The result expected is : http://example.com/redirect-lang/nl/my/original/url
but I keep having http://example.com/redirect-lang//my/original/url
(The language code stored in the cookie isn't retrieved.backreference I made isn't correct.
Edit: I deleted the cookies and send a request to http://example.com/testing/redirections/with/apache/mod/rewrite
and here is the ouput of the error log:
[....] init rewrite engine with requested uri /testing/redirections/with/apache/mod/rewrite
[....] applying pattern '^(.*)$' to uri '/testing/redirections/with/apache/mod/rewrite'
[....] pass through /testing/redirections/with/apache/mod/rewrite
[....] init rewrite engine with requested uri /sites/all/themes/theme_name/img/burger.png, referer: http://front.example.com/testing/redirections/with/apache/mod/rewrite
[....] applying pattern '^(.*)$' to uri '/sites/all/themes/theme_name/img/burger.png', referer: http://front.example.com/testing/redirections/with/apache/mod/rewrite
[....] pass through /sites/all/themes/theme_name/img/burger.png, referer: http://front.example.com/testing/redirections/with/apache/mod/rewrite
Any help would be appreciated.