Reputation: 165
I had successfully re-written almost all my urls from the old form to fine url using .htaccess rules. But I have a problem with some of the address formats
e.g example.com/myusername works fine while example.com/my.username throws back a 404 page not found
Note: my.username is a valid username in my database. Please how do I resolve this issue
Update: this is the complete code on the .htaccess file
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
#ErrorDocument 404 example.com
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [nc]
RewriteRule ^([a-zA-z0-9_-]+)$ community/profile.php?_username=$1
Upvotes: 1
Views: 142
Reputation: 3522
Resulting in
RewriteRule ^(.*)\.htm$ $1.php [nc,L,QSA]
RewriteRule ^([a-zA-z0-9_.-]+)$ community/profile.php?_username=$1 [L,QSA]
Upvotes: 0
Reputation: 7739
Your issue is that you didn't include the dot (.) in the regular expression in this line (since my.username contains a dot) :
RewriteRule ^([a-zA-z0-9_-]+)$ community/profile.php?_username=$1
Change it to this :
RewriteRule ^([a-zA-z0-9_.-]+)$ community/profile.php?_username=$1
Note that any character that may be in the username you must add to the regular expression (for now it supports alphanumerics, underscore, dash and dot).
Upvotes: 2