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]

```
A string's contents may contain a hyphen. A variable's name may not.

It's not clear in your question where the HTTP querystring comes into it. `$_GET['some-variable']` is fine, as the array key is a string. `$my-var` is not fine.

If your page requests aren't working, it's far more likely to be a problem with your `.htaccess` file.