Enabling .htaccess file to rewrite path (not working)

Enabling .htaccess file to rewrite path (not working)

firstly enable a2enmod

sudo a2enmod rewrite 


sudo service apache2 restart

sudo nano /etc/apache2/sites-enabled/000-default.conf

add these lines at end

<Directory /var/www/html>
    AllowOverride All


sudo service apache2 restart

Removing file extensions using htaccess

Removing file extensions using htaccess

  1. Log into your cPanel.
  2. Click on File Manager in cPanelFind the Files category and click on the File Manager icon.
  3. Show hidden files in settingsIn the top right hand corner, click on Settings. For the primary domain, click on the Web Root radio button. For addon domains, click on the dropdown and find your desired addon domain name. Be sure the checkbox next to Show Hidden Files is checked. Click the Save button to return to the main File Manager screen.
  4. Click on editYou should now be in the root folder of the domain you chose. Look for the .htaccess file and right click on it. This brings up a menu. Find and click on the Edit option. If you get a popup box, simply find and click the Edit button in the lower right corner to continue to the editor.
  5. You are now in the text editor. As most sites are coded with either htm or php, we have include the code for both below.
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)$ $1.php
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.html -f
    RewriteRule ^(.*)$ $1.html
  6. Be sure to hit the Save Changes button in the upper right corner to save your new htaccess configuration. Your site should now display the address without the file extension.



Who doesn’t love Indian food? Nothing quite beats the combination of bold, sophisticated spices, creamy sauce, and tangy heat. Not to mention all the extras that make traditional (and not so traditional) Indian dishes amazing; fluffy pulau rice, crispy onion bhajis, deep-filled samosas and chutney – there’s a reason it’s one of the UK’s best-loved options when it comes to ordering takeaway.

Must read Indian food facts:

But how much do you really know about Indian food culture? Don’t worry, we’re not going to quiz you, but we are going to fill you in with all the interesting Indian food facts you should know, from the origins of certain dishes to debunking particular myths. If you want to be the star of the show at your next Indian food feast, we’ve got you covered.

  • Authentic Indian cuisine balances six flavours

Indian food theory dictates that authentic Indian cuisine should be a balance of six different flavours: sweet (madhura), salty (lavana), sour (amala), pungent (katu), bitter (tikta), and astringent (kasya). Although, you’ll probably only be able to notice two of these flavours in your meal. Why not see which flavours you can taste next time you tuck in?

  • Spice Spice, Baby

No country on earth produces more varieties of spice than India, earning it the nickname ‘The Land of Spices’. Considering the number of dishes that use some sort of spice in traditional Indian cuisine, we shouldn’t be too surprised. In fact, you won’t find what we know as ‘curry powder’ in authentic Indian food, as every dish has spices blended and added separately to create unique flavours.

  • Masala Imposter

This one might surprise you. The classic Indian dish Chicken Tikka Masala isn’t from India. It was actually invented in Scotland! Due to its unrivalled popularity, it has become synonymous with authentic Indian cuisine across the UK, despite having very little connection to the country itself. So, the next time you order a Tikka Masala, just remember, it may taste amazing, but it’s not truly authentic.

  • Indian cuisine is extremely regional

Because India is so large and diverse, there’s really no such thing as one type of Indian food culture. Instead, each region uses different cooking methods and ingredients to create their recipes. Outside of India, Northern Indian cuisine is what we’re most accustomed to: thicker curries, samosas, rotis and meals flavoured with garam masala spice mix. Northern cuisine is generally less spicy and dishes are creamier, while Southern cuisine is usually hotter, featuring thinner dishes like stews and plenty of lentils and rice.

  • Rice is nice (even for breakfast)

When we think of rice, basmati or pulau probably spring to mind. However, with over 40,000 varieties of cultivated rice around the world, there are many more to discover. In particular, Southern India is home to a huge variety of rice-based dishes. In fact, in some regions, it’s not uncommon for rice to feature as part of your everyday breakfast – definitely not as takeaway leftovers from the evening before!

  • London has more Indian restaurants than Mumbai

The first legitimate Indian restaurant in the UK was opened in 1809. The popularity of Indian cuisine has since become so great, and the British have such an affinity for it, that it’s reported that London now has more Indian restaurants than Mumbai.

mail function not working in ec2 amazon aws php

mail function not working in ec2 amazon aws php

Just follow instructions below (Tested for ubuntu 10x EC2)

sudo apt-get install php-pear   // Install php-pear if not installed 

sudo pear install mail  

sudo pear install Net_SMTP

sudo pear install Auth_SASL

sudo pear install mail_mime

sudo apt-get install postfix

sudo service apache2 restart

mail function not working in ec2 amazon aws php

mail function not working in ec2 amazon aws php

Solution worked for me:

  1. install sendmail by command:
     sudo apt-get install sendmail
  2. check the service whether its started or not by execuring follwing command
    service sendmail status

    Note: Output of above command should be something – ‘Active: active (running)’

  3. start the service if it is not running by following command
    service sendmail start
  4. After the service is started, send a test mail using following command:
    echo "This is test mail body" | mail -s "Test Mail Subject" "recipient@email.com"

Replace email with your email ID and see if you receive this email, if yes, then your mail setup is fine and now your php email should be working fine.

hot to modify user group ubuntu

hot to modify user group ubuntu

To modify an existing user, like adding that user to a new group, use the usermod command.

Try this:

sudo usermod -a -G groupName userName

The user will need to log out and log back in to see their new group added.

  • The -a (append) switch is essential. Otherwise, the user will be removed from any groups, not in the list.
  • The -G switch takes a (comma-separated) list of additional groups to assign the user to.

How To Create a Sudo User on Ubuntu

How To Create a Sudo User on Ubuntu

The sudo command provides a mechanism for granting administrator privileges, ordinarily only available to the root user, to normal users. This guide will show you the easiest way to create a new user with sudo access on Ubuntu, without having to modify your server’s sudoers file. If you want to configure sudo for an existing user, simply skip to step 3.

Steps to Create a New Sudo User

  1. Log in to your server as the root user.
    • ssh root@server_ip_address
  2. Use the adduser command to add a new user to your system.Be sure to replace username with the user that you want to create.
    • adduser username
    • Set and confirm the new user’s password at the prompt. A strong password is highly recommended!
      Set password prompts:
      Enter new UNIX password:
      Retype new UNIX password:
      passwd: password updated successfully
    • Follow the prompts to set the new user’s information. It is fine to accept the defaults to leave all of this information blank.
      User information prompts:
      Changing the user information for username
      Enter the new value, or press ENTER for the default
          Full Name []:
          Room Number []:
          Work Phone []:
          Home Phone []:
          Other []:
      Is the information correct? [Y/n]
  3. Use the usermod command to add the user to the sudo group.
    • usermod -aG sudo username

    By default, on Ubuntu, members of the sudo group have sudo privileges.

  4. Test sudo access on new user account
    • Use the su command to switch to the new user account.
      • su – username
    • As the new user, verify that you can use sudo by prepending “sudo” to the command that you want to run with superuser privileges.
      • sudo command_to_run
    • For example, you can list the contents of the /root directory, which is normally only accessible to the root user.
      • sudo ls -la /root
    • The first time you use sudo in a session, you will be prompted for the password of the user account. Enter the password to proceed.
      [sudo] password for username:

      If your user is in the proper group and you entered the password correctly, the command that you issued with sudo should run with root privileges.

Launch a Linux Virtual Machine

Launch a Linux Virtual Machine

with Amazon EC2

Amazon Elastic Compute Cloud (EC2) is the Amazon Web Service you use to create and run virtual machines in the cloud. AWS calls these virtual machines ‘instances’. This step-by-step guide will help you successfully launch a Linux virtual machine on Amazon EC2 within our AWS Free Tier.

Did you know? AWS made it even easier to launch a Linux virtual private server. Jumpstart your virtual machine with Amazon Lightsail >>

Manage Your AWS Resources

Sign in to the Console

Step 1: Launch an Amazon EC2 Instance

a. Click here to open the Amazon EC2 console and then click Launch Instance to create and configure your virtual machine.

(click to zoom)

Step 2: Configure your Instance

You are now in the EC2 Launch Instance Wizard, which will help you configure and launch your instance.

a. In this screen, you are shown options to choose an Amazon Machine Image (AMI). AMIs are preconfigured server templates you can use to launch an instance. Each AMI includes an operating system, and can also include applications and application servers.

For this tutorial, find Amazon Linux AMI and click Select.

(click to zoom)

b. You will now choose an instance type. Instance types comprise of varying combinations of CPU, memory, storage, and networking capacity so you can choose the appropriate mix for your applications. For more information, see Amazon EC2 Instance Types.

The default option of t2.micro should already be checked.  This instance type is covered within the Free Tier and offers enough compute capacity to tackle simple workloads. Click Review and Launch at the bottom of the page.

(click to zoom)

c. You can review the configuration, storage, tagging, and security settings that have been selected for your instance. While you have the option to customize these settings, we recommend accepting the default values for this tutorial.

Click Launch at the bottom of the page.

(click to zoom)

d. On the next screen you will be asked to choose an existing key pair or create a new key pair. A key pair is used to securely access your Linux instance using SSH. AWS stores the public part of the key pair which is just like a house lock. You download and use the private part of the key pair which is just like a house key.

Select Create a new key pair and give it the name MyKeyPair. Next click the Download Key Pair button.

After you download the MyKeyPair key, you will want to store your key in a secure location. If you lose your key, you won’t be able to access your instance. If someone else gets access to your key, they will be able to access your instance.

Select your operating system below to see instructions on where to save your SSH key.

  • Windows

    Windows users: We recommend saving your key pair in your user directory in a sub-directory called .ssh (ex. C:\user\{yourusername}\.ssh\MyKeyPair.pem).

    Tip: You can’t use Windows Explorer to create a folder with a name that begins with a period unless you also end the folder name with a period. After you enter the name (.ssh.), the final period is removed automatically.

  • Mac / Linux

After you have stored your key pair, click Launch Instance to start your Linux instance.

(click to zoom)

e. Click View Instances on the next screen to view your instances and see the status of the instance you have just started.

(click to zoom)

f. In a few minutes, the Instance State column on your instance will change to “running” and a Public IP address will be shown. You can refresh these Instance State columns by pressing the refresh button on the right just above the table. Copy the Public IP address of your AWS instance, so you can use it when we connect to the instance using SSH in Step 3.

(click to zoom)

Step 3: Connect to your Instance

After launching your instance, it’s time to connect to it using SSH.

Windows users:  Select Windows below to see instructions for installing Git Bash which includes SSH.

Mac/Linux user: Select Mac / Linux below to see instructions for opening a terminal window.

  • Windows

    a. Download Git for Windows here. Run the downloaded installer accepting the default settings (this will install Git Bash as part of Git).

    (click to zoom)

    b. Right click on your desktop (not on an icon or file) and select Git Bash Here to open a Git Bash command prompt.

    (click to zoom)

    c. Use SSH to connect to your instance. In this case the user name is ec2-user, the SSH key is stored in the directory we saved it to in step 2 part d, and the IP address is from step 2 part f. The format is ssh -i {full path of your .pem file} ec2-user@{instance IP address}.

    Enter ssh -i ‘c:\Users\yourusername\.ssh\MyKeyPair.pem’ ec2-user@{IP_Address} (ex. ssh -i ‘c:\Users\adamglic\.ssh\MyKeyPair.pem’ ec2-user@

    You’ll see a response similar to the following:

    The authenticity of host ‘ec2-198-51-100-1.compute-1.amazonaws.com (’ can’t be established. RSA key fingerprint is 1f:51:ae:28:df:63:e9:d8:cf:38:5d:87:2d:7b:b8:ca:9f:f5:b1:6f. Are you sure you want to continue connecting (yes/no)?

    Type yes and press enter.

    (click to zoom)

    You’ll see a response similar to the following:

    Warning: Permanently added ‘ec2-198-51-100-1.compute-1.amazonaws.com’ (RSA) to the list of known hosts.

    You should then see the welcome screen for your instance and you are now connected to your AWS Linux virtual machine in the cloud.

    (click to zoom)
  • Mac / Linux





Step 4: Terminate Your Instance

You can easily terminate the instance from the EC2 console. In fact, it is a best practice to terminate instances you are no longer using so you don’t keep getting charged for them.

a. Back on the EC2 Console, select the box next to the instance you created.  Then click the Actions button, navigate to Instance State, and click Terminate.

(click to zoom)

b. You will be asked to confirm your termination – select Yes, Terminate.

Note: This process can take several seconds to complete.  Once your instance has been terminated, the Instance State will change to terminated on your EC2 Console.