Mod rewrite mod_rewrite-固定和可变查询字符串参数

Mod rewrite mod_rewrite-固定和可变查询字符串参数,mod-rewrite,Mod Rewrite,我想寄 www.mydomain.com/approve/SomeFunkyVariable to www.mydomain.com/home/index.php?option=com\u content&task=view&id=574&Itemid=85&approve=someFunkyVariable 规则是什么?完全忽略参数,因为您没有提到它们 RewriteEngine on RewriteRule ^approve/([^/\.]+)/?$ index.php?option=com

我想寄

www.mydomain.com/approve/SomeFunkyVariable to

www.mydomain.com/home/index.php?option=com\u content&task=view&id=574&Itemid=85&approve=someFunkyVariable


规则是什么?

完全忽略参数,因为您没有提到它们

RewriteEngine on
RewriteRule ^approve/([^/\.]+)/?$ index.php?option=com_content&task=view&id=574&Itemid=85&approve=$1 [L]
要包含参数,您需要一个url,如

www.mydomain.com/com_content/view/547/85/approve/SomeFunkyVariable

RewriteEngine on
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)?$ index.php?option=$1&task=$2&id=$3&Itemid=$4&$5=$6 [L]

所有参数从何而来?是在Apache配置文件中还是在.htaccess文件中?确定-这是.htaccess文件,参数是作为目标的固定URL的一部分。.htaccess文件中已有将短URL映射到长查询字符串URL的规则,因此无法使用Pez Cuckow的规则。我想要一个规则,将www.mydomain.com/approve/foobar映射到一个“固定”查询字符串url,并附加foobar。。。因此,如果固定查询字符串url在引号中,它会像下面这样,附加变量:www.mydomain.com/home/index.php?option=com\u content&task=view&id=574&Itemid=85&approve=fooberr,这正是我答案的前半部分所做的。啊,不知道我怎么会错过它!谢谢。总结[^/\.]+只意味着所有接受的字符,然后用$0引用它,其中0是上面正则表达式的编号