Force HTTPS & www

You want to force any URL that doesn't include either:

  1. HTTPS
  2. www subdomain
to be redirected to the corresponding URL including both.

The following directives in the .htaccess file worked for me for a simple static site:

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

There must be a way to make the first condition generic and avoid hardcoding domain.com, I just didn't investigate it, maybe you already know how & can comment below ;-)

The easy way to convert XML into PDF

J4L FO Designer is a productivity tool that helps you to convert XML files into PDF by using Apache FOP, the open and free implementation of the XLS-FO standard.

Our product intends to save you a significant amount of your time, and spare you the difficulties of a manual process. As explained in my previous post “How to create PDF files from XML with Apache-FOP”, XSL-FO and Apache-FOP provide a free and standard way to create PDF files in a language independent manner.

But there are a number of disadvantages with that approach, e.g.:

  • you have to learn XSL-FO (and therefore also XPath and XSL).
  • even if you know XSL-FO you do not want to be writing FO templates using a text editor.
  • there is some logic that cannot be easily defined using XSL-FO. For example, grouping of data requires you to use the so called Muenchian method , which isn't straightforward to understand.

In order to overcome these drawbacks, at J4L Components we have developed J4L FO Designer. The designer is a Visual (WYSIWYG) editor that will generate XSL-FO files for you. This makes the start into the XSL-FO world very easy, and it is also a useful tool for experienced developers since you can create and test XSL-FO files very quickly.