我已经在我的。htaccess文件中这样写了:
RewriteRule ^dashboard/(.*)/([0-9]+)/([0-9]+)/(.*)$ dashboard.php?view=$1&idteam=$2&idplayer=$3&layout=$4 [L]
我期望它会给我这个:
("视图")=>字符串(4)"team" ["idteam"]=> string(1)"5"
[" idplayer "] =>字符串(1)"1" ["layout"]=> string(10)"editplayer"
但是我得到了这个:
阵列(3){("视图")=>字符串(4)"团队"[" idteam "] =>字符串(1)"5"("布局")=>字符串(13)"1/editplayer"}
这是URL:
仪表板/团队/5/1/editplayer
这是整个htaccess:
ErrorDocument 404 /index.php
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^wmisports.com
RewriteRule (.*) http://www.wmisports.com/$1 [R=301,L]
#AddType application/x-httpd-php .html .htm
RewriteRule ^dashboard$ dashboard.php [L]
RewriteRule ^dashboard/view/newteam/(.*)$ dashboard.php?view=newteam&idcaptain=$1 [L]
RewriteRule ^dashboard/view/team/(.*)$ dashboard.php?view=team&idteam=$1 [L]
RewriteRule ^dashboard/team/([0-9]+)/(.*)$ dashboard.php?view=team&idteam=$1&layout=$2 [L]
#RewriteRule ^dashboard/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ dashboard.php?view=$1&idteam=$2&idplayer=$3&layout=$4 [L]
RewriteRule ^dashboard/([^/]+)/([^/]+)/([^/]+)/([^/]*)/?$ dashboard.php?view=$1&idteam=$2&idplayer=$3&layout=$4 [L]
请有人帮助了解什么是错误的我的代码。由于
试着用下面的代码替换你的代码:
RewriteRule ^dashboard/([^/]+)/([^/]+)/([^/]+)/([^/]*)/?$ dashboard.php?view=$1&idteam=$2&idplayer=$3&layout=$4 [L]
编辑:你的。htaccess应该是这样的:
ErrorDocument 404 /index.php
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^wmisports'.com$
RewriteRule (.*) http://www.wmisports.com/$1 [R=301,L]
#AddType application/x-httpd-php .html .htm
RewriteRule ^dashboard/([^/]+)/([^/]+)/([^/]+)/([^/]*)/?$ dashboard.php?view=$1&idteam=$2&idplayer=$3&layout=$4 [L]
RewriteRule ^dashboard/team/([0-9]+)/(.*)$ dashboard.php?view=team&idteam=$1&layout=$2 [L]
RewriteRule ^dashboard/view/newteam/(.*)$ dashboard.php?view=newteam&idcaptain=$1 [L]
RewriteRule ^dashboard/view/team/(.*)$ dashboard.php?view=team&idteam=$1 [L]
RewriteRule ^dashboard$ dashboard.php [L]