我想重定向以下链接
any-subdomain.domain-name.info/IGxxxx => https://www.mysite.de/link/ig/domain-name/xxx
any-subdomain.domain-name.info/IGxxxx/ => https://www.mysite.de/link/ig/domain-name/xxx我尝试了以下方法
RewriteCond %{HTTP_HOST}#%{REQUEST_URI} ^(?:.+\.)?([^.]+)\.#/IG([^/]+)$ [NC]
RewriteRule ^ https://www.mysite.de/link/ig/%1/%2 [L,NE,R=302]...but我不工作。
发布于 2020-06-22 14:16:41
你可以用这个鲁克:
RewriteCond %{HTTP_HOST}#%{REQUEST_URI} \.([^.]+)\.[^.#]+#/IG(.*)$ [NC]
RewriteRule ^ https://www.mysite.de/link/ig/%1/%2 [L,NE,R=302]推荐的解决方案:这里不需要使用复合变量,因为我们可以从RewriteRule模式中捕获值。
RewriteCond %{HTTP_HOST} \.([^.]+)\.[^.]+$
RewriteRule ^IG(.*)$ https://www.mysite.de/link/ig/%1/$1 [L,NC,NE,R=302]https://stackoverflow.com/questions/62516373
复制相似问题