Jump to content

Adding exceptions to HTACCESS rewrites for https


blmg2009

Recommended Posts

Hi there, 
 
I'm fairly new to sever management and apache. I'm having issues with curl requests on my website and i'm been told to: 
 

If your store redirects all traffic to a secure connection (using https) then you will need to add an exclude rule to ensure that the OpenBay Pro urls can still use http.
OpenBay Pro urls that need to be http are:
index.php?route=ebay/openbay/*
The * means anything after is included - there is several methods/urls within this file.


However even with searching online I can see how to add the exceptions for pages ending in certain file types and not for the exception mentioned above.

Here is my HTACCESS FILE:

# STARTNITRO
RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
ExpiresActive On


#CSS JS XML TXT - 1 WEEK
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, public"
ExpiresDefault "access plus 1 week"
</FilesMatch>


#JPG JPEG PNG GIF SWF SVG - 1 MONTH
<FilesMatch "\.(jpg|jpeg|png|gif|swf|svg|JPG|JPEG|PNG|GIF|SWF|SVG)$">
Header set Cache-Control "max-age=2678400, public"
ExpiresDefault "access plus 1 month"
Header set Last-Modified "Wed, 05 Jun 2009 06:40:46 GMT"
</FilesMatch>


#OTF WOFF TTF ICO PDF FLV - 1 MONTH
<FilesMatch "\.(otf|ico|pdf|flv|woff|ttf)$">
Header set Cache-Control "max-age=2678400, public"
ExpiresDefault "access plus 1 month"
</FilesMatch>
# ENDNITRO
# STARTCOMPRESSNITRO
RewriteEngine On


RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(\/?((catalog)|(assets)).+)\.css$ assets/style.php?l=4&p=$1&c=604800 [NC,L]


RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(\/?((catalog)|(assets)).+)\.js$ assets/script.php?l=4&p=$1&c=604800 [NC,L]
AddType image/svg+xml .svg
AddOutputFilterByType DEFLATE image/svg+xml
# ENDCOMPRESSNITRO


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]


# SEO URL Settings
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

I would really appreciate if someone could walk me through the code to modified to an the above exceptions.  

 

I believe it would be the following code I would need to edit: 

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

But like I mentioned i'm not entirely sure. 

 

 

 

Link to comment
Share on other sites

Yes, that's the code. Currently it says "if not using HTTPS then redirect to the https:// version of the page". That needs to be modified to say

If not using HTTPS and the page does not match that one OpenBay pattern then redirect to the https:// version of the page.

To get that new condition you can use

RewriteCond %{REQUEST_URI} !^/index.php?route=ebay/openbay/
(which assumes that this site is not located in a subdirectory underneath the domain) added next to the existing RewriteCond.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.