[英].htaccess rewrite rule- query string to folder
Using a .htaccess
rewrite rule, how would I rewrite the following?.. 使用
.htaccess
重写规则,我将如何重写以下内容?
I want to translate http://www.foo.com.au/soap?c=dem to http://www.foo.com.au/_pag/DEM . 我想将http://www.foo.com.au/soap?c=dem转换为http://www.foo.com.au/_pag/DEM 。
I also want to translate http://www.foo.com.au/soap/dem to http://www.foo.com.au/_pag/DEM . 我还想将http://www.foo.com.au/soap/dem转换为http://www.foo.com.au/_pag/DEM 。
Thanks in advance! 提前致谢!
Try this. 尝试这个。
RewriteEngine On
RewriteCond %{QUERY_STRING} c=([^&]+)
RewriteRule ^soap /_pag/${uppercase:%1}? [L,R=301]
RewriteRule ^soap/(.+)$ /_pag/${uppercase:$1} [L,R=301]
It's not tested and have not written rewrite conditions in while. 它未经测试,并且没有编写重写条件。
Also need this in apache or virtual host configuration: 在apache或虚拟主机配置中也需要此:
RewriteMap uppercase int:toupper
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.