Joomla has a convenient offline mode that allows admins to login at the front end to view the site.
Site >> Global Configuration
|
Now when you go to the front of the site a login screen will be displayed.
Those with an Administrator account can log in, but regular registered users can not.
What if I need to login as a front end user?
Instead of putting the site offline use htaccess to temporarily redirect all IPs except your own to a maintenance page.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.45\.67\.89$
RewriteCond %{REQUEST_URI} !/maintenance-page\.html$
RewriteRule ^([^/]*/)*(([^.]+\.)+(php|s?html?))?$ http://www.example.com/maintenance-page.html [R=302,L]