2012-12-17 4 views
0

.htaccess 파일을 사용하여 다시 쓰기 URL 규칙을 사용하려고합니다. 이것은 내 주 .htaccess 파일 (같은 디렉토리에있는 PHP 페이지에서만 작동합니다)에서 제대로 작동하는 것처럼 보입니다. 그러나 하위 .htaccess를 하위 디렉토리에 사용하려면 규칙이 전혀 적용되지 않습니다. 404 오류 페이지.디렉토리 내의 .htaccess에있는 URL 규칙을 다시 작성하십시오.

가리 키려는 파일은 /news/story.php입니다. story.php는 'article'이라는 정수 변수를 요청하여 데이터베이스에서 기사를 가져 와서 표시합니다. 그래서 기본적으로 내가 원하는 내가이 '뉴스'디렉토리 안에 htaccess로 파일에 다음과 같은 규칙을 사용하고 http://www.mydomain.com/news/story/article/1/

http://www.mydomain.com/news/story.php?article=1 을 대체합니다. 당신의 도움에 대한

# For security reasons, Option followsymlinks cannot be overridden. 
#Options +FollowSymLinks 
Options +SymLinksIfOwnerMatch 
RewriteEngine on 
RewriteRule story/article/(.*)/ story.php?article=$1 
RewriteRule story/article/(.*) story.php?article=$1 

감사

+1

폴더의 하위 폴더에 배치 page.php에 액세스 할'RewriteRule의 이야기/기사 /(.*) 하위 폴더/page.php? 글 = $ 1 '같은 시도 . 물론 RewriteRule 직후 부분은 필요에 따라 변경됩니다. –

+0

나는 당신이 제안한 것을 사용했고 그것은 지금 일하는 것처럼 보인다, 고마워! –

답변

0
RewriteRule story/article/(.*)/ news/story.php?article=$1 
RewriteRule story/article/(.*) news/story.php?article=$1 
+0

이 답변이 도움이 될 경우 답을 수락하십시오. –

관련 문제