我不知道这是可能还是非常奇怪但是这里有。我需要帮助
1)为用户文件夹执行Apache URL重写: /基本路径/组/用户/应用程序/
2)所有请求必须由相同的PHP脚本处理
/somepath/index.php
3)这就是问题,我需要PHP脚本才能访问组,用户和应用程序
http://www.somehost.com/usergroup/username/userapp/
应该执行说
http://www.somehost.com/index.php
但等同于
http://www.somehost.com/index.php?grp=usergroup&usr=user&app=app
我希望这是有道理的,先谢谢!!!!
经过深思熟虑! 基本上所有对所述域的请求都由相同的PHP脚本处理,路径转换为URI变量?更有意义吗?答案 0 :(得分:2)
您可以在根.htaccess文件中使用此规则:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /index.php?grp=$1&usr=$2&app=$3 [L,QSA]
答案 1 :(得分:0)
RewriteRule ^([^ /] +)/([^ /] +)/([^ /] +) ./index.php?group=$1&user=$2&app=$3 [NC]
这很有效。我的实际在线版本是:
######LOCALHOST (in house dev)
RewriteRule ^apps/([^/]+)/([^/]+)/([^/]+) ./index.php?pub=$2&app=$3&bld=$4 [NC,L]
RewriteRule ^apps/([^/]+)/([^/]+) ./index.php?pub=$2&app=$3&bld=release [NC]
######PRODUCTION (remote production)
RewriteRule ^([^/]+)/([^/]+)/([^/]+) ./index.php?pub=$1&app=$2&bld=$3 [NC,L]
RewriteRule ^([^/]+)/([^/]+) ./index.php?pub=$1&app=$2&bld=release [NC]