ApacheServer.htaccess使用通配符重写

ApacheServer.htaccess使用通配符重写,.htaccess,rewrite,.htaccess,Rewrite,是否可以创建包含通配符的重写代码 例如,任何请求: http://example.com/something1/something2/* 将重定向到: http://example.com/newthing 及 在.htaccess文件中,我将重写内容放在何处很重要吗?这应该适合您: RewriteEngine On RewriteRule ^something1/something2/(.*)$ /$1 [R=302,L] 它应该改变http://example.com/someth

是否可以创建包含通配符的重写代码

例如,任何请求:

 http://example.com/something1/something2/*
将重定向到:

 http://example.com/newthing


在.htaccess文件中,我将重写内容放在何处很重要吗?

这应该适合您:

RewriteEngine On
RewriteRule ^something1/something2/(.*)$ /$1 [R=302,L]
它应该改变http://example.com/something1/something2/test 到http://example.com/test

编辑:


谢谢客户刚刚更改了他们的请求。我如何将其从*hmm.exmample.com/shirts/*--现在重定向到--example.com/touching.html/*而url的其余部分与原始url中/shirts/之后的内容重复您不知道衣服之后的url的其余部分/?不确定您在问什么。目标是广泛重定向,以便所有以example.com/shirts开头的请求都将转储到example.com/toughts.html-感谢您的帮助,请将toughts/$1更改为toughts.html。
RewriteEngine On
RewriteRule ^shirts/(.*)$ /clothing.html [R=301,L]