/sc_assets/104/logo.png

Select a topic:

Choose from one of the topics below to browse other articles

Articles & Information.

Why "hosts" file is better than the Apache mod_userdir

Last updated by Dennis A. on May 09, 2016 01:30

It's a well-known fact that the Apache module mod_userdir provides an ability to access user-specific directories through the URLs that utilise the following syntax and may be useful when checking intermediate results during the web-site build process:

http://serveripaddress/~username/
http://serverhostname/~username/

And what is especially noteworthy, it's not even an obligatory requirement to have a domain pointed to the server in order to use this temporary URL system.

However, such approach can play a joke on you since sites that use mod_rewrite and other directives in their .htaccess files will not work as expected when viewed using mod_userdir URLs. We would also like to point out that almost all modern content management systems like WordPress, Joomla!, Drupal, Magento, etc. use mod_rewrite to form clean URLs. That's why we kindly recommend you to utilize "hosts" file on the local computer instead of the Apache mod_userdir URL. The following entries should be added to the "hosts" file in order to create mapping between your domain name and our server's IP addresses:

serveripaddress   yourdomain.co.uk
serveripaddress   www.yourdomain.co.uk

Once added, you will be able to enter your domain name into the browser's omnibox and the content that resides on our server will be displayed.