I have a site that is having some issues with it’s includes in that it is sometimes dynamically grabbing the path to the included files based on the HTTP version of the site, instead of a relative path. This is a cart coded in PHP, and it has tons of includes..
Is there any way to put something in place to have it detect if it’s calling from https, it rewrites the url to keep every call https? I “think” mod_rewrite will do this, but I have never used it. This is on a linux server, btw. Any ideas would be greatly appreciated!
Thanks,
-Ben
Includes aren’t normally done with http paths. They’re typically coded using absolute or relative file paths. It is possible to do an include using an http path (if “URL fopen wrappers are enabled” per the PHP manual). But not typical.
Redirects and ajax calls would be done via http and might be the source of the problem. An htaccess redirect would work as long as there aren’t POST (form) or GET variables going along with the request.
A quick Google turns up this solution:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
From http://joseph.randomnetworks.com/archives/2004/07/22/redirect-to-ssl-using-apaches-htaccess/
Tim
Thanks for the help. I realize that normally relative paths are the way to go, unfortunately, this shopping cart does some crazy things that are driving our developers completely insane..