是否可以创建包含通配符的重写代码?
例如:的任何请求
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
编辑:
RewriteEngine On
RewriteRule ^shirts/(.*)$ /clothing.html [R=301,L]