I am working on a new website bud I want to create a nice looking urls for my users. I don\'t know anything of htaccess
and could not find my solution on google
Using mod_rewrite, you can try:
RewriteEngine On
# the request URI doesn't already start with /users/
RewriteCond %{REQUEST_URI} !^/users/
# host doesn't start with www
RewriteCond %{HTTP_HOST} !^www\. [NC]
# host starts with something else
RewriteCond %{HTTP_HOST} ^([^\.]+)\.mywebsite\.com$ [NC]
# rewrite
RewriteRule ^(.*)$ /users/%1/$1 [L]
This will make it so when someone enters http://joe.mywebsite.com/some/page.html they will be served the file in /users/joe/some/page.html