.htaccess – all you ever wanted to know

.htaccess – all you ever wanted to know

For me, this has always been frustrating because I use it only once every 8-12 months. Here are some great links to get refreshed.

Basically, what I was trying to do was get all traffic https going to my customers’ mywebsite.com/payments page and all other traffic without “/payments” in the name to mymainwebsite.com. It is important to note, that the myshorturl.ca site is the one with the https or SSL on it. Here are the links I used

The eventual code form my .htaccess file was


#RewriteCond {HTTPS} on
#RewriteRule ^(.*)$ https://www.myshorturl.ca/payments/$1

#RewriteCond %{HTTPS} on
#RewriteRule .* https://www.myshorturl.ca/payments [R,L]

RewriteCond %{REQUEST_URI} /tithe [NC]
RewriteRule ^(.*)$ https://www.myshorturl.ca/payments/ [L,R=301]

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /payments [NC]
RewriteRule ^(.*)$ https://www.mycumbersomeurl.ca/payments/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www.mycumbersomeurl.com$ [NC]
RewriteRule ^(.*)$ http://www.mycumbersomeurl.com/$1 [L,R=301]

ELB Solutions.com Inc.
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.