2

この URL を変換したい:

http://ts.thebenamorgroup.com/g2g/category.php?cate=mens

に:

http://ts.thebenamorgroup.com/g2g/category/cate/mens/   

私はこのルールを持っていますが、うまくいきません:

Options +FollowSymLinks
RewriteEngine on
RewriteRule category/cate/(.*)/ category.php?cate=$1
RewriteRule category/cate/(.*) category.php?cate=$1
4

2 に答える 2

2

あなたの書き直しは反対方向です。つまり、書き換えます

http://ts.thebenamorgroup.com/g2g/category/cate/mens/ 

に:

http://ts.thebenamorgroup.com/g2g/category.php?cate=mens

リダイレクトしたい場合

http://ts.thebenamorgroup.com/g2g/category.php?cate=mens

に:

http://ts.thebenamorgroup.com/g2g/category/cate/mens/   

次に、使用できます:-

RewriteEngine on

RewriteBase /

RewriteCond %{QUERY_STRING} cate=(\d+) [NC]
RewriteRule ^g2g/category\.php$ /g2g/category/cate/%1/ [NC,R]
于 2013-07-09T05:50:19.497 に答える
1

試す:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /g2g/

RewriteRule ^category/cate/(.+?)/?$ category.php?cate=$1 [L]

RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /g2g/category\.php\?cate=([^&\ ]+)&?([^\ ]*)
RewriteRule ^ /g2g/category/cate/%2?%3 [L,R=301]
于 2013-07-09T05:32:31.297 に答える