这个.htaccess文件有问题

时间:2013-10-24 20:04:03

标签: 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&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/它找不到attr“country”

我尝试过做

  

echo $ _GET ['country'];

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

提前致谢

1 个答案:

答案 0 :(得分:2)

您的上一个条目缺少问号:

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