Php 此.htaccess文件有问题

Php 此.htaccess文件有问题,php,.htaccess,rewrite,Php,.htaccess,Rewrite,这是我当前的htaccess文件 DirectoryIndex index.php RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^register/ index.php?view=register [L] RewriteRule ^news/([0-9]+)/[0-9a-z\-]*/$ index.php?view=news&

这是我当前的htaccess文件

DirectoryIndex index.php

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^register/ index.php?view=register [L]

RewriteRule ^news/([0-9]+)/[0-9a-z\-]*/$ index.php?view=news&id=$1&page=$2 [L]
RewriteRule ^movie/([0-9]+)/[0-9a-z\-]*/$ index.php?view=movies&id=$1&title=$2 [L]
RewriteRule ^actor/([0-9]+)/[0-9a-z\-]*/$ index.php?view=actor&id=$1&name=$2 [L]

RewriteRule ^country/([0-9]+)/[0-9a-z\-]*/$ index.php?view=country&id=$1&name=$2 [L]
RewriteRule ^country/([0-9]+)/[0-9a-z\-]/[0-9]*/$ index.php view=country&id=$1&name=$2$country=$3 [L]
问题是如果我访问domain.com/country/3/usa/1/它找不到属性“country”

我已经试过了

echo$_获得[国家]

但它只返回一个未识别的变量


提前感谢

您的最后一个条目缺少问号:

RewriteRule ^country/([0-9]+)/[0-9a-z\-]/[0-9]*/$ index.php?view=country&id=$1&name=$2&country=$3 [L]

通过.htaccess文件实现路由是一种糟糕的做法;它现在不返回任何内容,甚至不返回错误:$var\u dump/print\u r$\u GET并确保所有内容都被传入。我编辑了答案,因为您使用了
&name=$2$country=$3
而不是
&name=$2&country=$3
,这意味着$u GET['country']不存在。