drdarwin
drdarwin

Reputation: 107

can't escape dot (.) at my mod_rewrite code

i need to transform following address of my site: http://mysite.com/do.php?id=123.W456/789 into http://mysite.com/123.W456/789

i've almost got succeed in this noble purpose with following .htaccess file

DirectoryIndex mysite.php

RewriteEngine On RewriteRule ^([A-Za-z0-9\/.]+)?$ mysite.php?id=$1 [L]

where . is a code of . (dot) character

it goes cool with such url string http://mysite.com/123W456/789 (i.e rewrites it to http://mysite.com/do.php?id=123W456/789)

but DOESN'T rewrite url string with dot character - http://mysite.com/123.W456/789

can anybody help?

Upvotes: 7

Views: 1685

Answers (1)

animuson
animuson

Reputation: 54757

We use \. to escape the dot character in an htaccess file, not the HTML entity for it. Using the HTML entity would make it think that you are allowing the &, #, and ; characters rather than the . character.

Upvotes: 4

Related Questions