apache - Setting cookies via mod_rewrite fails -
i'm building site on top of codeigniter. make uris prettier ci uses mod_rewrite rule
rewritecond $1 !^(index\.php|img|css|js|fonts|robots\.txt) rewriterule ^(.*)$ /index.php/$1 [nc]
now i'd allow people request pages in specific language, i.e. process both normal https://example.com/home , language-specific https://example.com/spa/home. @ stage it's pretty troubling me create new controllers, want set language cookie , rewrite original uri. after reading articles on mod_rewrite, came this
rewritecond %{query_string} ^(eng|spa|ger|fre)/(.*) [nc] rewriterule ^(.*)$ %2 [r,nc,qsa,co=lang:%1:.example.com:1440:/] rewritecond $1 !^(index\.php|img|css|js|fonts|robots\.txt) rewriterule ^(.*)$ /index.php/$1 [nc]
however, when try access https://example.com/spa/home uri doesn't rewritten, lang
cookie not set, , 404 page not found error returned.
my guess rule , original codeigniter rule conflicting. they? , mistake?
many thanks!
upd: apache/2.4.10
try this:
rewritecond %{request_uri} ^/(eng|spa|ger|fre)/(.*) [nc] rewriterule ^(eng|spa|ger|fre)/(.*)$ /$2 [r,nc,qsa,co=lang:%1:ubtv.local:1440:/]
Comments
Post a Comment