.htaccess mod_rewrite将删除?页面=精细,获取&;id=不工作

.htaccess mod_rewrite将删除?页面=精细,获取&;id=不工作,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我的.htaccess正在正常运行: webshop/index.php?page=home至webshop/home 如果我把id放在URL中,它仍然需要是webshop/product&id=1。我想创建的是webshop/product/1 我在网上搜索了很多选项,但都没能找到。下面的代码是我的.htaccess文件 Options +FollowSymLinks -MultiViews RewriteEngine On # Removes index.php from URL R

我的.htaccess正在正常运行:
webshop/index.php?page=home
webshop/home


如果我把id放在URL中,它仍然需要是
webshop/product&id=1
。我想创建的是
webshop/product/1


我在网上搜索了很多选项,但都没能找到。下面的代码是我的.htaccess文件

Options +FollowSymLinks -MultiViews
RewriteEngine On

# Removes index.php from URL 
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]

# Rewrites /home to be /index.php?page=home
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^webshop/([^/]*)$ /webshop/?page=$1 [QSA]
希望你们能帮助我。

你们可以使用:

Options +FollowSymLinks -MultiViews
RewriteEngine On

# Removes index.php from URL 
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]

# skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# Rewrites /webshop/product/1 to be /webshop/index.php?page=product&id=1
RewriteRule ^webshop/([^/]+)/(\d+)/?$ /webshop/?page=$1&id=$2 [NC,QSA,L]

# Rewrites /webshop/home to be /webshop/index.php?page=home
RewriteRule ^webshop/([^/]*)$ /webshop/?page=$1 [NC,QSA,L]

如果您的id不仅仅是一个数字,您可以将
(\d+)
更改为
([^/]+)
,谢谢!对我有用。