2

This question has an accepted answer at Stackoverflow


I have a PHP file named as otp.php.

When URL in the URL bar is

http://localhost/college/otp/MTA=/teacher

It should be treated as

http://localhost/college/otp.php?user=MTA=&role=teacher

For this, I created .htaccess file in http://localhost/college/:

RewriteEngine On    # Turn on the rewriting engine
RewriteCond %{HTTP_HOST} localhost  [NC]
RewriteRule    (.*otp)\/([A-Za-z0-9-]+=)\/([A-Za-z0-9-]+)  $1.php?user=$2&role=$3  [NC,L]

But, otp.php file says:

Notice: Undefined index: role in C:\wamp\www\college\otp.php on line 11

Notice: Undefined index: user in C:\wamp\www\college\otp.php on line 11

**See Image**


Created question here after this Comment.

Two Different Results:

paran
  • 31

0 Answers0