Reputation: 852
I have a htaccess setup like so:
RewriteRule ^([A-Za-z_]+)$ profile.php?name=$1 [NC,B,QSA]
it works fine however it doesn't work when the parameter has a number in it.
also is it possible to allow periods and commas?
What can I change?
Upvotes: 0
Views: 310
Reputation: 784908
Change the regex:
RewriteRule ^([0-9A-Za-z_]+)$ profile.php?name=$1 [L,QSA]
OR even better
RewriteRule ^(\w+)/?$ profile.php?name=$1 [QSA,L]
Since \w
is same as [0-9A-Za-z_]
is there a way to let it use periods and commas as well?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([\w,.]+)/?$ profile.php?name=$1 [QSA,L]
Upvotes: 3