Reputation: 545
I'm trying to roll my own user registration script in PHP. I have users and groups.
I want people to be able to access user profiles at domain.com/users/username
and group profiles at domain.com/groups/groupname
In my htaccess I have the following:
Options -Indexes
<Files "config.php">
Order Allow,Deny
Deny from All
</Files>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /users/index.php?username=$1
This works for users but I have no idea how to modify this to work for groups too. I'm sure this is a very simple adjustment but I've had little luck Googling solutions.
Thanks.
Upvotes: 1
Views: 169
Reputation: 784898
Have your 2 rules setup like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^users/([^/]+)/?$ /users/index.php?username=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^groups/([^/]+)/?$ /groups/index.php?groupname=$1 [L,QSA]
Upvotes: 1