双参数URL重写


Double Parameter URL Rewrite

我有以下URL与双参数和第一次想做双参数重写。

我的URL: http://localhost/b2b/post?post_id=1&post_subject=test

我想重写为:http://localhost/b2b/post/post_id/1/post_subject/test

我的。htaccess是:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_METHOD}  !=POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}'s([^.]+)'.php [NC]
RewriteRule ^ %1 [R,L,NC]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<Files ~ "^(.*)'.(inc|tpl|sql)$">
    Order deny,allow
    Deny from all
</Files>

你应该这样写:

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^post/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)$  /post.php?$1=$2&$3=$4 [L]