如何重写example.com/catelogue.php?page=3&;cat1=水果和蔬菜;cat2=带.htaccess的苹果
有人能帮我修改一下.htaccess的url吗?我是新手,遇到了下面这个问题 我有这个网址如何重写example.com/catelogue.php?page=3&;cat1=水果和蔬菜;cat2=带.htaccess的苹果,php,apache,.htaccess,mod-rewrite,url-rewriting,Php,Apache,.htaccess,Mod Rewrite,Url Rewriting,有人能帮我修改一下.htaccess的url吗?我是新手,遇到了下面这个问题 我有这个网址 http://example.com/catelogue.php?page=3 http://example.com/catelogue.php?page=3&cat1=fruit&cat2=apple 我希望这样 http://example.com/catelogue http://example.com/catelogue/fruit/apple 下面是我的.htaccess
http://example.com/catelogue.php?page=3
http://example.com/catelogue.php?page=3&cat1=fruit&cat2=apple
我希望这样
http://example.com/catelogue
http://example.com/catelogue/fruit/apple
下面是我的.htaccess文件,但这里的问题是我已经实现了这一点(example.com/catelogue/fruit/apple),但我无法将我的url重定向到(example.com/catelogue)
这应该行得通。这样试试你的规则。它对我有用
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^catelogue/([^/]+)/([^/]+)$ catelogue.php?page=3&cat1=$1&cat2=$2 [NC,L]
RewriteRule ^catelogue/?$ catelogue.php?page=3 [NC,L]
RewriteRule ^home/?$ index.php?page=1 [NC,L]
可能重复的
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^catelogue/([^/]+)/([^/]+)$ catelogue.php?page=3&cat1=$1&cat2=$2 [NC,L]
RewriteRule ^catelogue/?$ catelogue.php?page=3 [NC,L]
RewriteRule ^home/?$ index.php?page=1 [NC,L]