Jump to content

Need help with a working .htaccess file that redirects http to https but does not screw up the cart.


bikini_browser

Recommended Posts

Hello...

 

My inexperienced developers wrote a .htaccess file and it seems to have screwed up the whmcs product cart link according to tech support. And tech support won't support .htaccess files so I am left to you fine folks for getting the support I need.

 

So instead of corrupting your minds with the file they wrote, I would rather ask for you folks to submit working .htacceess files and let me try them on my system.

 

Please keep the following in mind...

 

I am using the wordpress CMS in the home folder with HTTPS forced on.

 

My WHMCS installation is in the /billing/ folder off of the WordPress home folder.

 

I have the WordPress WHMCS PRO Bridge installed and the the WordPress home page is MEMBERS (virtual Page or wordpress page)

 

Remember, the goal here is to force http to redirect to https and not to break the cart links. I will include you in on the email threads from tech support so far...

 

see below

 

-----------------------------------------------------------

Sir:

 

Standard hosting package

One of the links on our products list for our standard hosting package is copied verbatim strait from the links section of the products area for you here: https://www.bananapages.net/billing/cart.php?a=add&pid=1. But when you click on that link it resolves to this link https://www.bananapages.net/billing/cart/?a=confproduct&i=0 and the page cannot be found resulting in a 404 error.

 

Advanced Hosting Package

This link is copied right from the products page:

https://www.bananapages.net/billing/cart.php?a=add&pid=3

and it resolves to this link

https://www.bananapages.net/billing/cart/?a=add&pid=3 and the page cannot be found with a 404 error.

 

Business Hosting Package

This link is copied right from the products page:

https://www.bananapages.net/billing/cart.php?a=add&pid=7

and it resolves to this link

https://www.bananapages.net/billing/cart/?a=add&pid=7

and the page cannot be found with a 404 error.

 

So can you tell me what is going on?

 

Dale

 

____________________________

 

 

Hello,

 

Looking at the end result URLs, I can confirm that this is not an issue with WHMCS itself - but rather something removing the .php from the cart.php file name and breaking the link. That appears to be caused by one of the .htaccess files in your website, so you would need to review these one by one and remove any rewrite rules from them. Once the issue is resolved, you can check those rules and adjust them to ignore the billing folder in general. If you are unsure of how to do so, you will need to contact your hosting provider or system administrator for help with that as we do not provide support for custom .htaccess rules.

 

 

--------------------------------------------

Hello Dale,

 

You could likely use something like the following to force HTTPS on your domain:

 

====SNIP START====

 

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

 

====SNIP END====

 

You can review this example and more at the following third-party website:

http://www.inmotionhosting.com/support/website/ssl/how-to-force-https-using-the-htaccess-file

 

Another great resource, if you have experience with server administration, would be the mod_rewrite documentation page at http://httpd.apache.org/docs/current/mod/mod_rewrite.html

 

Something to note is that WHMCS uses a smart SSL switcher and is designed to only utilise HTTPS on pages that pass sensitive data. This means that forcing HTTPS across all pages can cause a conflict with WHMCS itself and will cause a redirect loop.

 

One way to avoid this redirect loop is to login to your WHMCS Admin Area, go to Setup > General Settings > General, clear your "WHMCS SSL System URL" value, replace your "WHMCS System URL" value with the HTTPS version of your domain, and then hit Save Changes. However, this is an unsupported configuration as this isn't how WHMCS is designed to function.

 

-----------------------------------------------------------------------------------------

 

In conclusion, any help from anyone out there would be accepted..

 

Thanks in advance...

 

Dale Allen

Link to comment
Share on other sites

Hello Dale,

 

Are you looking to use https:// across both Wordpress and WHMCS?

 

If so it should be a matter of changing the Wordpress URL in the Wordpress settings and the system URL in the WHMCS general settings.

 

If it's only for the cart then setting both the system URL (using http://) and system secure URL (using https://) in the WHMCS general settings should work. As WHMCS automatically redirects the cart.php pages to https:// when the secure URL is set to https://.

 

Jack

Link to comment
Share on other sites

Hello Dale,

 

Are you looking to use https:// across both Wordpress and WHMCS?

 

If so it should be a matter of changing the Wordpress URL in the Wordpress settings and the system URL in the WHMCS general settings.

 

If it's only for the cart then setting both the system URL (using http://) and system secure URL (using https://) in the WHMCS general settings should work. As WHMCS automatically redirects the cart.php pages to https:// when the secure URL is set to https://.

 

Jack

 

Yes we are using https on both WP and WHMCS...

Our host came up with this:

 

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

 

But it fails to work correctly using MS Edge and IE browsers - for windows 10 (Won't Redirect HTTP to HTTPS correctly) and it breaks my cart links using those browsers. Interesting though, Firefox & chrome work just fine for the cart & for the redirecting.

 

Finally,

 

When finished, I need to be able to load these following lines or similar lines that get the same job done without breaking my product cart links or my HTTP to HTTPS redirector or my basic site...

-------------------------------

RewriteEngine on

RewriteCond %{REQUEST_URI} ^(.*)/facebook(.*)+ [NC]

RewriteRule ^(.*)$ index.php?p=facebook&pid=$1 [QSA,L]

 

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !^(.*)/n_(.*)+ [NC]

RewriteRule ^(.*)?$ index.php?p=$1 [QSA,L]

 

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} ^(.*)/n_(.*)+ [NC]

RewriteRule ^n_(.*)[_+?]?$ index.php?p=news&nid=$1 [QSA,L]

 

<Files template_*.html>

order deny,allow

deny from all

</Files>

 

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

 

# END WordPress

 

So I am still in the "market" for a working solution. Looking for help, ANYBODY?

 

Dale

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated