Php 双参数URL重写
我有下面的URL与双参数和第一次想做双参数重写 我的网址:http://localhost/b2b/post?post_id=1&post_subject=test 我想把它改写成:http://localhost/b2b/post/post_id/1/post_subject/test 我的.htaccess是:Php 双参数URL重写,php,url,rewrite,Php,Url,Rewrite,我有下面的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 / R
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]
很抱歉,只是没用。。。无论如何,谢谢你。。请帮助它可能是一个请求URI或需要的请求查询?您的.htaccess位于哪个文件夹中?本地主机?b2b?邮递重写是否对一个参数有效?在我看来,你的.htaccess是一团糟。您应该阅读本页: