dyanmic URL重写不是HT访问 [英] dyanmic url not rewriting ht access
问题描述
我所有的重写从一个工作分开。当用户搜索我想要的网址到地址栏显示正确。
All my rewrites are working apart from one. When a user searches I want the URL to show correctly in the url bar.
Options +FollowSymLinks
RewriteEngine on
RewriteBase /website/
RewriteCond %{THE_REQUEST} /search\?c=([^&\s]+)&s=([^&\s]+)&mincost=([^&\s]+)&maxcost=([^&\s]+)&sort_by=([^&\s]+)&colour=([^&\s]+) [NC]
RewriteRule ^search/%1/%2/%3/%4/%5/%6? [L,R]
RewriteRule ^product/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ product.php?id=$1&c=$2&name=$3&page=$4 [L,QSA]
RewriteRule ^product/([^/]+)/([^/]+)/([^/]+)/?$ product.php?id=$1&c=$2&name=$3 [L,QSA]
RewriteRule ^search/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ search.php?c=$1&s=$2&mincost=$3&maxcost=$4&sort_by=$5&colour=$6&page=$7 [L,QSA]
RewriteRule ^search/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ search.php?c=$1&s=$2&mincost=$3&maxcost=$4&sort_by=$5&colour=$6 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
/网页/搜索/分类/所有/ 100/500 /低到高/任何颜色
/website/search/category/all/100/500/low-to-high/any-colour
(当输入到地址栏工作)
(works when entered into the url bar)
/website/search?c=category&s=all&mincost=100&maxcost=500&sort_by=low-to-high&colour=any-colour
/website/search?c=category&s=all&mincost=100&maxcost=500&sort_by=low-to-high&colour=any-colour
(使用过滤器,并提交表单时显示) - 我需要这个网址显示为:
(shows when using filter and submitting form) - I need this url to show as:
/网页/搜索/分类/所有/ 100/500 /低到高/任何颜色
/website/search/category/all/100/500/low-to-high/any-colour
推荐答案
你的第一个重写规则
是不正确的。通过替换它:
Your first RewriteRule
is not correct. Replace it by:
RewriteCond %{THE_REQUEST} /search\?c=([^&\s]+)&s=([^&\s]+)&mincost=([^&\s]+)&maxcost=([^&\s]+)&sort_by=([^&\s]+)&colour=([^&\s]+) [NC]
RewriteRule ^ search/%1/%2/%3/%4/%5/%6? [L,R=302,NE]
请注意间距 ^
和搜索
这篇关于dyanmic URL重写不是HT访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!