Take out the boot carpet, use it as a template on a large sheet of MDF and cut the MDF to form a new layer for the boot floor.
Now cover that floor in some car carpet (Autoleads make some that matches the colour of the OE carpet very well) so it doesn't look horrible. Spray on glue and some staples underneath where the carpet goes under the floor does a good job of this.
Then remove the sub from the box, place the box where you want it, screw through the base of the box into this new MDF floor (a screw in each corner and one in the middle will do) and re-fit the sub.
As the MDF floor is the same size and shape as the boot, it wont move around. And since the box is screwed to that, that wont be moving either
All this will take around 20 minutes if you're handy with a jigsaw.