cluster Posted June 6, 2021 Report Posted June 6, 2021 how can the lang string in the url be rewritten to point to a virtual folder and exclude the admin folder from rewrite? https://www.mydomain.tld/?lang=en_us -> https://www.mydomain.tld/en/ https://www.mydomain.tld/?lang=fr_fr -> https://www.mydomain.tld/fr/ https://www.mydomain.tld/?lang=de_de -> https://www.mydomain.tld/de/ I've tried this but it doesn't work RewriteRule ^en/(.*) /?lang=en_us/$1 [NC,L,QSA] RewriteRule ^fr/(.*) /?lang=fr_fr/$1 [NC,L,QSA] RewriteRule ^de/(.*) /?lang=de_de/$1 [NC,L,QSA] also following doesn't work # Force HTTPS RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=307,NE,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php RewriteCond %{REQUEST_URI} ^(.*)/install.php$ RewriteRule install.php %1/install/ [R=301,L] RewriteCond %{QUERY_STRING} lang=en_us RewriteCond %{QUERY_STRING} lang=de_de RewriteCond %{QUERY_STRING} lang=fr_fr # exclude all requests starting with /admin/ RewriteCond %{REQUEST_URI} !^/admin/.*$ RewriteRule ^(.*) /en/$1? [L,R=301] RewriteRule ^(.*) /fr/$1? [L,R=301] RewriteRule ^(.*) /de/$1? [L,R=301] Quote
0 Blesta Addons Posted June 7, 2021 Report Posted June 7, 2021 even if the .htaccess work, the blesta will still generate links without any lang prefix . cluster 1 Quote
Question
cluster
how can the lang string in the url be rewritten to point to a virtual folder and exclude the admin folder from rewrite?
https://www.mydomain.tld/?lang=en_us -> https://www.mydomain.tld/en/ https://www.mydomain.tld/?lang=fr_fr -> https://www.mydomain.tld/fr/ https://www.mydomain.tld/?lang=de_de -> https://www.mydomain.tld/de/
I've tried this but it doesn't work
RewriteRule ^en/(.*) /?lang=en_us/$1 [NC,L,QSA] RewriteRule ^fr/(.*) /?lang=fr_fr/$1 [NC,L,QSA] RewriteRule ^de/(.*) /?lang=de_de/$1 [NC,L,QSA]
also following doesn't work
# Force HTTPS RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=307,NE,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php RewriteCond %{REQUEST_URI} ^(.*)/install.php$ RewriteRule install.php %1/install/ [R=301,L] RewriteCond %{QUERY_STRING} lang=en_us RewriteCond %{QUERY_STRING} lang=de_de RewriteCond %{QUERY_STRING} lang=fr_fr # exclude all requests starting with /admin/ RewriteCond %{REQUEST_URI} !^/admin/.*$ RewriteRule ^(.*) /en/$1? [L,R=301] RewriteRule ^(.*) /fr/$1? [L,R=301] RewriteRule ^(.*) /de/$1? [L,R=301]
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.