views:

120

answers:

1

Greetings all,

I need help combining some htaccess rewrites, these crazy regular expressions screw with my head.

So I have a folder structure something like this:

     /www/mysite.com/page/member/friends.php
     /www/mysite.com/page/video/videos.php
     /www/mysite.com/page/messages/inbox.php

The URLs get rewritten to this:

     mysite.com/member/friends.php
     mysite.com/video/videos.php
     mysite.com/messages/inbox.php

(Notice the /page/ folder is hidden in the url, but I keep it on the server for better file organization)

The rewrite rules look something like this: (I'm new so correct me if they are flawed)

     RewriteRule ^video/(.*)$ /page/video/$1 [NC]
     RewriteRule ^member/(.*)$ /page/member/$1 [NC]
     RewriteRule ^messages/(.*)$ /page/messages/$1 [NC]

Now, I also need to do a completely different rewrite to a file called lobby.php inside of the member folder:

After the original rewrites, a sample url looks like:

     mysite.com/member/lobby.php?member=pws5068

I need a new rewrite to make it look like this:

     mysite.com/pws5068

Thank you for bearing with my super-long question here. How can I make this happen?

EDIT: To make this less confusing I'm moving lobby up a directory into just /page/ by itself.

+2  A: 

since you access 2 files in your member folder, you should differentiate them in your url structure. For instance:

 RewriteRule ^member/friends/(.*)$ /page/member/friends.php?id=$1 [NC]
 RewriteRule ^member/(.*)$ /page/member/lobby.php?id=$1 [NC]

update

According to your edit, it should now be

 RewriteRule ^member/friends/(.*)$ /page/member/friends.php?id=$1 [NC]
 RewriteRule ^member/(.*)$ /page/lobby.php?id=$1 [NC]
pixeline
Actually, I do have more files in my member folder. I'm going to move lobby outside of it to make this less confusing because it is the unique case. So it will be /page/lobby.php and /page/member/friends.php
pws5068
i corrected my answer, i had understood something incorrectly.
pixeline