Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 403
drdarwin Avatar asked Oct 19 '11 18:10

drdarwin


1 Answers

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.

like image 170
animuson Avatar answered Sep 20 '22 12:09

animuson