我尝试了很多选择,但是没有一个:(我希望有足够的信息.解决方案您可以在 RewriteRule 本身中排除它: RewriteEngine开启RewriteCond%{HTTP_HOST} ^(www \.)?domain \ .com $ [NC]RewriteRule!^ validation http://domain2.com% {REQUEST_URI} [NE,NC,R = 301,L] I'm trying to redirect all urls from one domain to another but one (kind of). This is the htaccess I have to redirect all keeping the same url except of the domain (for example domain.com/something goes to domain2.com/something).RewriteEngine OnRewriteBase /RewriteCond %{HTTP_HOST} ^domain.com$ [OR]RewriteCond %{HTTP_HOST} ^www.domain.com$RewriteRule ^(.*)$ "http://domain2.com/$1" [R=301,L]What I want to know is how to redirect all except if the url is domain.com/validation/*/validation/ is not a subfolder and it has to be the next part of the url after the domain (domain.com/something/validation can redirect, and domain.com/validation/something can't).I tried a lot of options but none worked :(I hope is enough information. 解决方案 You can exclude it in RewriteRule itself:RewriteEngine OnRewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]RewriteRule !^validation http://domain2.com%{REQUEST_URI} [NE,NC,R=301,L] 这篇关于htaccess-重定向除一个网址外的所有网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!