Localhost

Map local IP with local domain name

Find hosts file at C:\Windows\System32\Drivers\etc

  1. If hosts file is editable jump directly to STEP-6
  2. Create a simple new.txt
  3. Open hosts file and copy all contents and then, paste it in new.txt
  4. Renamed hosts to hosts_
  5. Also renamed new.txt to hosts
  6. Now your hosts file shall be editable for adding local domain names in future
  7. And at the very last line in hosts file add 127.0.0.0 mapped with new local domain name(hello.loc) in a new line as shown below:

127.0.0.1            localhost
127.0.0.1            hello.loc


Note: IP with port number not allowed (127.0.0.1:8080)configure it in httpd-vhosts.conf


Allow Virtual Hosts

Find httpd.conf file at C:\wamp\bin\apache\Apache2.4.9\conf

  • Open file and find line with "# Include conf/extra/httpd-vhosts.conf"
  • Uncomment(remove # at the start of the line) for this particular line
  • The lines shall look like# Virtual hosts

Include conf/extra/httpd-vhosts.conf


Map your Drupal Website folder with Domain Name

Find httpd-vhosts.conf file at C:\wamp\bin\apache\Apache2.4.9\conf\extra
Added below lines at the very bottom, where 8080(default is 80) is port number.

<Directory C:/wamp/www>
Order Deny,Allow  
Allow from all
</Directory>

<VirtualHost *:8080>  
DocumentRoot "C:/wamp/www/drupalsitefolder"
ServerName hello.loc
</VirtualHost>

Note: For drupal multisite(using one drupal code set) new <VirtualHost> is not required

Comments

Drupal Contribution
Git Commands
RESTful Services
Lando Commands
Docker Commands
MySQL
Database Quick Code
Drush Commands
Drupal Console
PHP Quick Code
Drupal Quick Code
Composer Commands
Linux Commands
Linux Shell Scripting
Drupal Hooks
Twig Tricks
PHPUnit Test
PhpMyAdmin
Drupal Constants
CSS Clues
BLT Commands
Vagrant Commands
Localhost
127.0.0.1
Drupal Interview
Drupal Certifications
Concept & Definitions
Mac Tips
Windows Tips
Browser Tips

Best Practice

Use 'elseif' instead of 'else if'
#CodingTips

As of PHP 5.4 you can also use the short array syntax, which replaces array() with []
#CodingTips

Functions in general shall be named using snake_case(say, my_function()), and using camelCase(say, myFunction()) when declared within a plugin class
#CodingTips

Variables in general shall be named using snake_case(say, $my_variable), and using camelCase(say, $myVariable) when declared within a plugin class
#CodingTips

Manage automatically assigning of new permissions whenever a module is enabled here- admin/config/people/accounts
#ConfigurationTips

Manage source of Main-menu and User-menu links here- admin/structure/menu/settings
#ConfigurationTips

Helper function(s) shall be named prefixing an underscore(say, _my_helper_function()), which can prevent hooks from being called
#CodingTips

Ideally, configuring of 'Private file system path' at admin/config/media/file-system should be located outside of your Drupal root folder(say, ../my_private_files)
#ConfigurationTips

You should be aware that uploading files as 'Private file' will slow down the process of loading the files as Drupal has to be bootstrapped for every file that needs to be downloaded
#ConfigurationTips #BeAware

Code should always be pushed up(dev -> staging -> production) and databases should only be pushed down(production -> staging -> dev)
#DevelopmentTips

Get Raw SQL Query of drupal dynamic queries before executing it using $query->__toString();
#DebugTips

In VI-Editor, Press ESC key to come in command mode and for undo type :U and for redo type :Ctrl+R
#LinuxTips

Insert queries must always use a query builder object(layer of abstraction), allowing individual database drivers special handling for column values (if applicable), example case for LOB and BLOB fields.
#DatabaseQueryTips

Drupal uses the .inc extension to prevent files from being executed directly.
#DevelopmentTips

Popular Posts