Apache Configuration Redirects version 2.1.1.11
1. How to configure apache to redirect complete site to https?
1. How to configure apache to redirect complete site to https?
Configuration:-
Below are 3 different way to configure apache
------------------------------
2. How to redirect to catch IE7 & 8 out of date browser?
Configuration:-
4. How to prevent Poodle attack?
Configuration:-
5. How to implement http to https for any URL?
Configuration:-
Say we need to redirect the below URL from http to https
http://www.travel.com/gb/en/travel-information/customer-service/eu-claims/passenger-eu-claims.html
6. How to set rule to block the request for any string?
Configuration:-
7. How to respond 404 page for a Non-exsistent pages?
Configuration:-
RewriteCond %{REQUEST_FILENAME} !-f: The rewriting to "page Not found for the request url"page will take place if the requested filename is not a regular file or if the file doesn't exist.
8. How to configure apache for IE to keep using highest version of IE browser and don’t take user to lower IE version?
Configuration:-
In addition to release deployment, we need to get below changes done in Apache httpd.conf file. Once changes are done, apache need to be restarted as well. These changes are required for IE to keep using highest version of IE browser and don’t take user to lower IE version.
1. Check if below line is uncommented in file
2. Add below section in file
9. How to enable server status URL in Apache?
Configuration:-
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} ^(staging2\.)?virgin-atlantic\.com$ [NC]
RewriteRule ^$ https://staging2.virgin-atlantic.com%{REQUEST_URI} [R=301,NC]
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} ^(staging2\.)?virgin-atlantic\.com$ [NC]
RewriteRule ^$ https://staging2.virgin-atlantic.com%{REQUEST_URI} [R=301,NC]
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NE,R]
2. How to redirect to catch IE7 & 8 out of date browser?
Configuration:-
RewriteCond %{HTTP_USER_AGENT} "Trident/4.0" [NC]
RewriteCond %{HTTP_USER_AGENT} "MSIE [7-8]" [NC]
RewriteCond %{REQUEST_URI} !^/.*browser-support-ie-outdated.html
RewriteCond %{REQUEST_URI} !^/.*\.(png|gif|jpg|jpeg)
RewriteCond %{HTTP_REFERER} !.*browser-support-ie-outdated.html
RewriteCond %{env:VAA_HTTPS}_%{HTTP_HOST} (.*)_(.+) [NV]
RewriteRule ^/([^/]*)/en.html http%1://%2/$1/en/browser-support-ie-outdated.html [R=301,L]
3. How to allow external webservice through apache to the application server?
Configuration:-
# Always set these headers.
Header always set Access-Control-Allow-Origin "https://secure-dev3.ecnp.bankofamerica.com/applynow/confirmation.go"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Allow-Credentials "true"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type"
# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
4. How to prevent Poodle attack?
Configuration:-
SSLEnable
SSLProtocolDisable SSLv2 SSLv3
SSLCipherSpec ALL -SSL_RSA_WITH_RC4_128_MD5 -SSL_RSA_WITH_RC4_128_SHA
5. How to implement http to https for any URL?
Say we need to redirect the below URL from http to https
http://www.travel.com/gb/en/travel-information/customer-service/eu-claims/passenger-eu-claims.html
# START to make 1 URLs HTTPS: CHANGE-1 OUT OF 2
RewriteCond %{REQUEST_URI} !^(.*/travel-information/customer-service/eu-claims/passenger-eu-claims/.*\.html)
RewriteCond %{REQUEST_URI} !^(.*/travel-information/customer-service/eu-claims/passenger-eu-claims.html)
# FINISH to make 1 URLs HTTPS: CHANGE-1 OUT OF 2
# START to make 1 URLs HTTPS: CHANGE-2 OUT OF 2
RewriteCond %{HTTP:WL-Proxy-SSL} "!True"
RewriteCond %{env:VAA_HTTPS}_%{HTTP_HOST} (.*)_(.+) [NV]
RewriteRule ^(.*/travel-information/customer-service/eu-claims/passenger-eu-claims.*) https://%{HTTP_HOST}$1 [NE,L]
# FINISH to make 1 URLs HTTPS: CHANGE-2 OUT OF 2
6. How to set rule to block the request for any string?
Configuration:-
RewriteCond %{QUERY_STRING} ^.*(bxss.me).* [NC]
RewriteRule ^(.*) - [F,L]
Configuration:-
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . http://acc.virgin-atlantic.com/gb/en/404.html [L,R=301]
URLs that do not exist on our site currently result in a redirection chain to a custom 404 page based on the current cookie. This is causing SEO issues. To fix this we have applied redirect rule for any non-existent URL to return a 404 response at source. It should not result in redirection.
RewriteCond %{REQUEST_FILENAME} !-f: The rewriting to "page Not found for the request url"page will take place if the requested filename is not a regular file or if the file doesn't exist.
8. How to configure apache for IE to keep using highest version of IE browser and don’t take user to lower IE version?
Configuration:-
In addition to release deployment, we need to get below changes done in Apache httpd.conf file. Once changes are done, apache need to be restarted as well. These changes are required for IE to keep using highest version of IE browser and don’t take user to lower IE version.
1. Check if below line is uncommented in file
LoadModule headers_module modules/mod_headers.so
2. Add below section in file
IfModule headers_module --- Put with < >
Header set X-UA-Compatible: IE=edge
/IfModule --- Put with < >
Configuration:-
# Server-status enabled
Location /server-status --- put with < >
SetHandler server-status
Order deny,allow
Allow from all
/Location --- put with < >