How to allow the movement of the character go diagonal.

Im trying to allow my character move diagonal when i click w and a or w and d.

Script c#

using UnityEngine;
using System.Collections;

public class PlayerMove : MonoBehaviour {

public Rigidbody rb;
public float moveSpeed;
public float speed;

// Use this for initialization
void Start () {

	rb = GetComponent<Rigidbody>();

}

// Update is called once per frame
void Update () {

	if (Input.GetKey (KeyCode.W)){
		rb.MovePosition (transform.position - transform.forward * moveSpeed);
	} else if (Input.GetKey (KeyCode.S)) {

		rb.MovePosition (transform.position + transform.forward * moveSpeed);

	}
	else if (Input.GetKey (KeyCode.D)) {
		
		rb.MovePosition (transform.position - transform.right * moveSpeed);
		
	}
	else if (Input.GetKey (KeyCode.A)) {
		
		rb.MovePosition (transform.position + transform.right * moveSpeed);
		
	}

	if (Input.GetKey (KeyCode.LeftArrow))
		transform.Rotate(Vector3.down * speed);

	if (Input.GetKey (KeyCode.RightArrow))
		transform.Rotate(Vector3.up * speed);

}

}

First, you have unnecessary else in else if (Input.GetKey (KeyCode.D)) { - with this D will never be read if W or S is pressed.

Second, each call to rb.MovePosition override all previous calls, made at the same frame, so you need to sum your delta movements like this:

Vector3 delta = Vector3.zero;

if (Input.GetKey(KeyCode.W)) { 
    delta += -transform.forward * moveSpeed;
}  else if (Input.GetKey(KeyCode.S)) {
    delta += transform.forward * moveSpeed;
}

if (Input.GetKey(KeyCode.D)) {
    delta += -transform.right * moveSpeed;
} else if (Input.GetKey(KeyCode.A)) {
    delta += transform.right * moveSpeed;
}

rb.MovePosition(rb.position + delta);