0
 /index.php?search_category=32
to
/32

表示されたときに同じクエリ文字列ルールで自動的に変更される.htaccesように、s でこれを行う方法は?"/index.php?search_category=32""/32"

前もって感謝します

4

1 に答える 1

0

In the htaccess file in the directory your index.php file is in, you need to add these rules. For example, if the directory is /xyz/:

RewriteEngine On

RewriteBase /xyz/

RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteCond %{QUERY_STRING} ^search_category=([0-9]+)
RewriteRule ^index.php$ %1? [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9]+)$ index.php?search_category=$1 [L,QSA]

This is setup so you can swap the htaccess file in any directory as long as you change the RewriteBase to the directory the htaccess file is in (including the document root, /).

于 2012-09-12T00:23:39.057 に答える