2011-11-26 1 views
0

...htaccess 다중 레벨 디렉토리 재 작성 규칙에 어떤 문제가 있습니까? 내 htaccess로 몇 가지 문제가

내 URL의이 같은를 갖고 싶어 :

문제는 http://example.com "을 제외한 URL의 모든 작업입니다
http://example.com/artist/ 
http://example.com/artist/rihanna/ 
http://example.com/artist/rihanna/biography/ 
http://example.com/artist/rihanna/video/ 
http://example.com/artist/rihanna/news/ 

/아티스트/"

RewriteRule ^artist/([^_]*)/biography/$ /artist-biography.php?name=$1 [L] 
RewriteRule ^artist/([^_]*)/biography?$ /artist/$1/biography/ [R=301,L] 

RewriteRule ^artist/([^_]*)/video/$ /artist-video.php?name=$1 [L] 
RewriteRule ^artist/([^_]*)/video?$ /artist/$1/video/ [R=301,L] 

RewriteRule ^artist/([^_]*)/news/$ /artist-news.php?name=$1 [L] 
RewriteRule ^artist/([^_]*)/news?$ /artist/$1/news/ [R=301,L] 

RewriteRule ^artist/([^_]*)/$ /artist.php?name=$1 [L] 
RewriteRule ^artist/([^_/]+)$ /artist/$1/ [R=301,L] 

RewriteRule ^artist/$ /artist-page.php [L] 
RewriteRule ^artist?$ /artist/ [R=301,L] 
+0

'http : // example.com/artist /'에 액세스하려고하면 어떻게됩니까? –

+0

백 슬래시 유무에 관계없이 "페이지가 올바르게 리디렉션되지 않음" – m3tsys

답변

2

이 줄

한다 RewriteRule^아티스트/([^ _ *)? $/아티스트/$ 1/[R = 30 1, L]

은 아마도 당신이 원하는 것이 아닐 것입니다. 아래와 같이 변경하십시오.

RewriteRule ^artist/([^_/]+)$ /artist/$1/ [R=301,L] 

그래도 문제가 해결되지 않으면 결과를 알려주세요.

+0

이제 오류가 발생하지 않지만 "http://example.com/artist//"로 리디렉션됩니다 – m3tsys

+0

' example.com/artist //는 첫 번째 역 참조'$ 1'이 비어 있음을 나타냅니다. 그러나 내가 준 규칙 ('^ _ /] +)'은 빈 문자열과 일치해서는 안됩니다 ...이 규칙이 .htaccess의 규칙과 동일한 지 확인할 수 있습니까? –

+0

나는 무엇을 말할 지 모르겠다 ... 나는 당신이 말한 것처럼 첫 번째 게시물에서와 같이 코드를 변경했다. 그래서 문제가 무엇이되어야 하는가? – m3tsys

관련 문제