我的实际和“所需” URL是(并且工作正常):
www.example.com/flower
文件是
www.example.com/indexmodelo.php?carpeta=flower
但是我有指向“ IP”而不是“ carpeta”的相同目标的旧网址
www.example.com/indexmodelo.php?IP=202
当您放置时,我需要它:
www.example.com/indexmodelo.php?carpeta=flower
OR
www.example.com/indexmodelo.php?IP=202
转到:
www.example.com/flower
在我的.htaccess文件中,我有:
RewriteEngine on
Options -MultiViews
RewriteCond %{THE_REQUEST} \s/indexmodelo\.php\?carpeta=([0-9a-zA-Z_\-&=]+)\s [NC]
RewriteRule ^ /%1? [R=301,L]
RewriteRule ^([0-9a-zA-Z_\-&=]+)$ /indexmodelo.php?carpeta=$1 [L]
感谢您的帮助!