使用 RewriteCond 和 RewriteRule 更改我的 URL

Using RewriteCond and RewriteRule to change my URLs

下午好,

我正在尝试使用 RewriteCond 和 RewriteRule 自动将 URL 从一个地方更改为一个新地方。

这是我的尝试:

RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index\.php\?option=com_sobipro&pid=(.*)\ HTTP
RewriteRule ^ /component/sobipro/%2 [R=301,L]

我需要更改此:http://www.idermo.es/index.php?option=com_sobipro&pid=1&sid=14408

为此:http://www.idermo.es/component/sobipro/14408.html

如您所见,我只需要获取号码即可将其放入新的 URL,但我无法完成这项工作。你能帮帮我吗?

目前它只显示这个:idermo.es/component/sobipro/1&sid=14408?option=com_sobipro&pid=1&sid=14408

编辑:

我已经更改了我的 "entries" 的存储位置 (Joomla) 并且 URL 像 "idermo.es/index.php?option=com_sobipro&pid=1&sid=14408" 不再活跃,但一些用户可能正在使用它(因为他们在打印的 QR 码内),我希望这些用户被重定向到像 "idermo.es/component/sobipro/14408" URL.

这样的新用户

提前致谢。

以下应该有效:

RewriteEngine On

RewriteCond %{QUERY_STRING} option=com_sobipro.*&sid=(\d+)
RewriteRule index.php$ /component/sobipro/%1? [R,L]

这将检查查询字符串以确保它匹配 option=com_sobipro 并获取 sid

后面的数字