Assume you have database called Sales_DB in your SQL Server. You planning to migrate this databases to another SQL Server and you want to place the database files (.mdf and .ldf) in different locations to those recorded in the backup from the original server.
Below script will help you to restore Sales_DB database to different location. Note that the MOVE option requires the specification of the logical file name, rather than the original physical file path.
RESTORE DATABASE Sales_DB
FROM DISK = 'F:\Backups\ Sales_DB.bak'
WITH MOVE ' Sales_DB _Data' TO 'S:\ Sales_DB.mdf',
MOVE ' Sales_DB _Log' TO 'L:\ Sales_DB.ldf';