Question: Update
------

In my original post I seem to have implied my variable name has a hyphen. My issue seems to be with the htaccess file below not matching on a hyphen but my $\_GET variable content has a hyphen, not the variable itself.

original
--------

I originally referenced <http://php.net/manual/en/language.variables.variable.php> which a user stated it is not possible to reference a php variable (by $\_POST or $\_GET) with a hyphen but this was written in 2009.

In one of my URL's, I allow users to enter a unique ID as "www.site.com/id123" which the "id123" is picked up as a $\_GET variable with php. Some users have chosen to use "www.site.com/id-123" which does not work (no server error other than page cannot be found).

Any ideas on this?

.htaccess
---------

```
RewriteEngine On

#if file or directory do not exist, try as an unique id
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9a-zA-Z]+)$ index?ID=$1 [QSA,NC,L]

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [QSA,L]

```

Thinking through more, the rewrite rule above seems it may need modification to handle a hyphen request. Does this seem right?

Answer: 
Your `.htaccess` file needs modifying to support hyphens.

Change

```
RewriteRule ^([0-9a-zA-Z]+)$ index?ID=$1 [QSA,NC,L]

```

to

```
RewriteRule ^([0-9a-zA-Z-]+)$ index?ID=$1 [QSA,NC,L]

```
One *could* use the alternative syntax for quirky variable names:

```
${'my-var'} = 123;

```

But as the other answers said, that's wholly irrelevant for your case. You don't need it. Since you receive the data as value you wouldn't even need to honor the $\_GET variable name transformation.

The problem in your case (page not found) sounds like a `RewriteRule` issue. Check that it does contain the hyphen in its regex:

```
RewriteRule  ^([\w+\-]+)$  get.php?id=$1

                #  ^^  missing

```