There are various ways you can approach this and they depend on various factors such as the production /dev enviroments you are using or have available. In short though it is important to have the same (or as similar as is possible) enviroment for both - same versions of web server, magento, PHP +modules, MySQL or other DB etc.
One way to approach it is to have production online
www.yourdomain.com and to create you development server by doing a full copy of the magento root folder (you dont need /var folder in this ) and a full copy of your database. Set this up to be accessed as
To get this to work you would need to change the settings in the database table
core_config_data that are set to
dev.yourdomain.com and also change the the file
/app/etc/local.xml to edit the database connection values to point to your development database.
It can take a bit of troubleshooting to get working but usually any issues are related to cache so keep deleting /var/cache folder to clear it out , also clear you browsers cache or even better use incognito mode /private browsing. You can also try adding random parameters add the end of the url like
dev.yourdomain.com?random123 you are testing to force you browser to see it as a different page and to not load from browser cache.
You should also not it is a good idea to then use separate browsers, say chrome and firefox, to access the live & dev admins and for site testing because using the same browser can cause confusion due to cookies and session issues.
Another possible approach is as above but to have the development environment on your local PC, leaving everything set up as
www.yourdomain.com and to use a HOSTS file switcher application (or manunally change hosts files but that gets annoying very quickly) to point www.yourdomain.com to 127.0.0.1 localhost.