我需要为我网站的所有GET请求创建一条规则,以便:
获取/articles/topic1.html?showall=1
被重写为:
获取/articles/topic1.html
我在Joomla网站上有以下.htaccess文件:
RewriteEngine On
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [OR]
RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]
########## This is the Rule I have added ################
RewriteRule ^(.*)$ /$showall=1 [R=301,L]
RewriteBase /
我在我添加的专栏中添加了评论。不幸的是它不起作用,浏览器警告我,我已经生成了循环循环....
知道怎么解决吗? 谢谢 弗兰克
答案 0 :(得分:0)
尝试将其替换为:
RewriteCond %{QUERY_STRING} ^showall=([0-9])+$
RewriteRule ^articles/topic[0-9]*\.html /articles/topic%1.html? [L]
或者如果它真的是topic1.html
,那么你想要这个:
RewriteCond %{QUERY_STRING} ^showall=1$
RewriteRule ^articles/topic1\.html /articles/topic1.html? [L]