The chemical, physical and mechanical properties of the extra-cellular environment have a strong effect on cell migration. Aspects such as pore-size or stiffness of the matrix influence the selection of the mechanism used by cells to propel themselves, including pseudopod or blebbing. How a cell perceives its environment,and how such a cue triggers a change in behaviour are largely unknown, but mechanics is likely to be involved. Because mechanical conditions are often controlled by modifying the composition of the environment, separating chemical and physical contributions is difficult and requires multiple controls. Here we propose a simple method to impose a mechanical compression on individual cells without altering the composition of the gel. Live imaging during compression provides accurate information about the cell's morphology and migratory phenotype. Using Dictyostelium as a model, we observe that a compression of the order of 500Pa flattens the cells under gel by up to 50%. This uniaxial compression directly triggers a transition in the mode of migration, from primarily pseudopodial to bleb driven, in less than 30 sec. This novel device is therefore capable of influencing cell migration in real time and offers a convenient approach to systematically study mechanotransduction in confined environments.