We want to apply two rewrite rules
1. Make uppercase to lower case
2. Forward http to https
We have this in our dispatcher but it's failing deployment and messing other scripts - can anyone point out what is wrong here?
RewriteMap lowercase int:tolower
RewriteCond $1 [A-Z]
RewriteRule ^/?(.*)$ /${lowercase:$1} [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @aembytes
Please use the below rule for upper case to lower case:
#Rule to ignore Case
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} ^(.*)[A-Z]+(.*)$
RewriteCond %{REQUEST_URI} !.*\..*$
RewriteRule (.*) ${lc:$1} [R,L]
For HTTP to HTTPS on Apache please use below:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule /(.*) https://%{SERVER_NAME}/$1 [R,L]
If you are running apache on 443 then the above rule is not required as the HTTP to HTTPS redirect can be handled at the ALB and apache will always receive request with HTTPs traffic. This is something that I prefer.
Thanks!
Hi @aembytes
Please use the below rule for upper case to lower case:
#Rule to ignore Case
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} ^(.*)[A-Z]+(.*)$
RewriteCond %{REQUEST_URI} !.*\..*$
RewriteRule (.*) ${lc:$1} [R,L]
For HTTP to HTTPS on Apache please use below:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule /(.*) https://%{SERVER_NAME}/$1 [R,L]
If you are running apache on 443 then the above rule is not required as the HTTP to HTTPS redirect can be handled at the ALB and apache will always receive request with HTTPs traffic. This is something that I prefer.
Thanks!
Hi - Can you please check rewrite logs to see how request is flowing ? Please enable the rewrite log in the configuration if not done.
"LogLevel info rewrite:info".
Then - please do the necessary configuration changes.
Views
Likes
Replies