开发者

More HtAccess Rewrite Rules

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:

开发者_JAVA百科
     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.


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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜