mod_rewrite建议

时间:2009-12-06 09:58:30

标签: .htaccess mod-rewrite url-rewriting seo

我想知道你是否可以建议是否有更有效的方式来写下我的内容?这可以在1规则中实现吗?

RewriteRule ^search/(cars|boats|plant)/([-a-zA-Z0-9]+)/type-([0-9]+)/price-([0-9]+)-([0-9]+)/?$ search.php?category=$1&location=$2&type=$3&minprice=$4&maxprice=$5 [L]
RewriteRule ^search/(cars|boats|plant)/([-a-zA-Z0-9]+)/type-([0-9]+)/?$ search.php?category=$1&location=$2&type=$3 [L]
RewriteRule ^search/(cars|boats|plant)/([-a-zA-Z0-9]+)/?$ search.php?category=$1&location=$2 [L]
RewriteRule ^search/(cars|boats|plant)/?$ search.php?category=$1 [L]

此外,在提交表单后,我很难获得友好的URL。怎么做?

1 个答案:

答案 0 :(得分:1)

也许你最好只编写一条规则从/ search重定向到search.php,然后在那里解析URI的其余部分? (即重定向到search.php?q = REST_OF_URI_GOES_HERE)