2011-09-23 4 views
-1

나는 URL을htaccess로 정규 표현식 구문

http://www.domain.com/category/abc-xyz-zzz-2010-150857.html 
to 
http://www.domain.com/category/150857-abc-xyz-zzz-2010.html 

그러나

http://www.domain.com/category/150857-abc-xyz-zzz-2010.html 
not redirect 

경우이가 내 htaccess로 리디렉션하지만

RewriteRule ^([^.]+)/([A-Za-z]+)-([0-9]+).html$ $1/$3-$2.html [L,R=301] 

탄원은 내가 그것을

를 해결하는 데 도움이 작동하지합니다 고정

RewriteRule ^([^.]+)/([A-Za-z]*)-([^.]+)-([0-9]+).html$ $1/$4-$2-$3.html [L,R=301] 

답변

0

이 시도 : 여기 RewriteRule ^([^.]+)/([0-9]+)-([A-Za-z0-9]+).html$ $1/$3-$2.html [L,R=301]

0
RewriteRule ^category/([a-zA-Z]*)-([a-zA-Z]*)-([a-zA-Z]*)-(\d+)-(\d+).html$ category/$5-$1-$2-$3-$4.html [L] 
0
^([^.]+)/([A-Za-z]+)-([0-9]+).html$ $1/$3-$2.html 

귀하의 문제는 당신이 대시 또는 계정에 숫자도 두 번째 그룹을하지 않는다는 것입니다. 이 것이 작동해야합니다 :

^(.+)/([A-Za-z\-]+)-([0-9]+)-([0-9]+)\.html$ $1/$4-$2-$3.html