Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 更多HtAccess重写规则_.htaccess_Mod Rewrite_Friendly Url_Seo - Fatal编程技术网

.htaccess 更多HtAccess重写规则

.htaccess 更多HtAccess重写规则,.htaccess,mod-rewrite,friendly-url,seo,.htaccess,Mod Rewrite,Friendly Url,Seo,大家好, 我需要帮助结合一些htaccess重写,这些疯狂的正则表达式让我头疼 我有一个文件夹结构,类似这样: /www/mysite.com/page/member/friends.php /www/mysite.com/page/video/videos.php /www/mysite.com/page/messages/inbox.php mysite.com/pws5068 URL将被重写为: mysite.com/member/fr

大家好,

我需要帮助结合一些htaccess重写,这些疯狂的正则表达式让我头疼

我有一个文件夹结构,类似这样:

     /www/mysite.com/page/member/friends.php
     /www/mysite.com/page/video/videos.php
     /www/mysite.com/page/messages/inbox.php
     mysite.com/pws5068
URL将被重写为:

     mysite.com/member/friends.php
     mysite.com/video/videos.php
     mysite.com/messages/inbox.php
(请注意,/page/文件夹隐藏在url中,但为了更好地组织文件,我将其保留在服务器上)

重写规则看起来是这样的:(我是新来的,如果有缺陷,请纠正我)

现在,我还需要对成员文件夹中名为lobb.php的文件进行完全不同的重写:

原始重写后,示例url如下所示:

     mysite.com/member/lobby.php?member=pws5068
我需要重新编写,使其看起来像这样:

     /www/mysite.com/page/member/friends.php
     /www/mysite.com/page/video/videos.php
     /www/mysite.com/page/messages/inbox.php
     mysite.com/pws5068
谢谢你在这里接受我的超长问题。我怎样才能做到这一点


编辑:为了减少混淆,我将一个目录向上移动到/page/中。

既然您访问了成员文件夹中的两个文件,您应该在url结构中区分它们。例如:

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

根据您的编辑,现在应该是

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

实际上,我的会员文件夹中有更多的文件。我将把大厅移到外面,以减少混乱,因为这是一个独特的案例。所以是/page/lobby.php和/page/member/friends.phpi更正了我的答案,我理解不正确。你确定mysite.com/member/lobby.php?member=pws5068变成mysite.com/pws5068而不是mysite.com/member/pws5068?现在它只变成mysite.com/member/lobby.php?member=pws5068,但我的目标是让它成为mysite.com/pws5068。这是组织得很差,所以我道歉。我正在把一个目录上移到just/page/