0

I'm using the following URL rewrite rule:

#URL Rewriting
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?username=$1 [L]

This is working just fine for most accounts, but if the username has a dot in it (e.g. User.Name) then my rewrite is failing and the page won't load.

RavinderSingh13
  • 117,272
  • 11
  • 49
  • 86
Drew Angell
  • 25,879
  • 5
  • 30
  • 49

1 Answers1

2

I believe in your regex you could add . to catch it in user name so add it like this way. I am on mobile I haven't tested it should work I believe. Also this is a fix of OP's attempted code only. Added one more condition to check query string passed is null to avoid loop here.

##URL Rewriting
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^([A-Za-z0-9-.]+)/?$ index.php?username=$1 [L]
RavinderSingh13
  • 117,272
  • 11
  • 49
  • 86