for example the current redirect rule is for content/project/de/de, Now I want to add redirect rule for other languages like /content/project/de/es , /content/pro/de/en , /content/pro/de/ro etc.
here condition is:
Can anyone help me?
# RewriteRule for the default short URL when the first path is not starting with 2 letters
RewriteCond %{REQUEST_URI} !^/[a-z]{2}/ [NC]
RewriteRule ^/([^/]{2})/(.*)$ ${B_ROOT}/$1/$2.html [PT,L]
# RewriteRule for paths starting with /{lang}/ to append them to /content/project/{lang}/
RewriteRule ^/([a-z]{2})/(.*)$ /${B_LOCATION}/$1/$2 [PT,L]
Define B_SITE "/content/project"
Define B_ROOT "${B_SITE}/de/de"
Define B_LOCATION "{B_SITE}/de"
Solved! Go to Solution.
Views
Replies
Total Likes
Please try following:
Define B_SITE "/content/project"
Define B_ROOT "${B_SITE}/de/de"
# RewriteRule for paths starting with /{lang}/ to append them to /content/project/{lang}/
RewriteRule ^/([a-z]{2})/(.*)$ /${B_SITE}/de/$1/$2 [PT,L]
# RewriteRule for the default short URL when the first path is not starting with 2 letters
RewriteCond %{REQUEST_URI} !^/[a-z]{2}/ [NC]
RewriteRule ^/([^/]{2})/(.*)$ ${B_ROOT}/$1/$2.html [PT,L]
Hi @tejuuu123
your question is not 100% clear, could you please add examples of request and corresponding redirect requests.
Please try following:
Define B_SITE "/content/project"
Define B_ROOT "${B_SITE}/de/de"
# RewriteRule for paths starting with /{lang}/ to append them to /content/project/{lang}/
RewriteRule ^/([a-z]{2})/(.*)$ /${B_SITE}/de/$1/$2 [PT,L]
# RewriteRule for the default short URL when the first path is not starting with 2 letters
RewriteCond %{REQUEST_URI} !^/[a-z]{2}/ [NC]
RewriteRule ^/([^/]{2})/(.*)$ ${B_ROOT}/$1/$2.html [PT,L]
@tejuuu123 Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies