-2

I want to rewrite a url in .htaccess file. in localhost for localhost/pdo/connect?id=3 as localhost/pdo/connect/3 I am using this

RewriteEngine On RewriteRule ^/connect/([0-9]+)$ connect.php?id=$1 [L].

But in connect.php I am getting an error:

undefined index id in $_Get["id"]

Yurets
  • 3,999
  • 17
  • 54
  • 74

1 Answers1

0

Try this one

RewriteCond "%{REQUEST_URI} "!connect.php"

RewriteRule ^connect/([^/]+).*" "connect.php?id=$1" [L,QSA,PT]

above rule working as follow.

www.sitename.com/connect/id

Chirag
  • 363
  • 2
  • 12