2012-04-15 9 views
1

htacess를 사용하여 http://givehands.co.in/post.php?p=post&id=1에서 http://givehands.co.in/post/1/까지 URL을 다시 쓰려고했습니다.재 작성 대신 재 작성 조건 리디렉션

하지만 URL을 다시 쓰지 않고 http://givehands.co.in/post.php?p=post&id=1으로 리디렉션됩니까? 내 도메인 givehands 내 웹 서버의 하위 디렉토리에 매핑됩니다.

정확한 재 작성 규칙을 도와 줄 수 있습니까? 이 새로운 Iam. 이 힘에 전체 URL을 퍼팅

RewriteCond %{REQUEST_URI} post/ 
RewriteRule post/ http://givehands.co.in/post.php [L] 

아파치를 다시 작성하는 대신 브라우저를 리디렉션 : 당신이 전체 사용자의 리디렉션 규칙의 URL을 가지고있는 것처럼

Options -Multiviews 
RewriteEngine On # Turn on the rewriting engine 
RewriteBase/
RewriteCond %{REQUEST_URI} post/(.*) 
RewriteRule post/(.*)/ http://givehands.co.in/post.php?p=post&id=$1 [L] 
RewriteCond %{REQUEST_URI} post/ 
RewriteRule post/ http://givehands.co.in/post.php [L] 
+1

후 당신의 .htaccess의 내용에 대한 주제입니다. 아마도'[L]'만 가져야 할 때'[L, R]'을 가지고있을 것입니다. –

+0

.htaccess 파일의 내용없이 질문에 확실하게 대답 할 수 없습니다. – aefxx

+0

htacess 콘텐츠를 업데이트했습니다. –

답변

1

는 것 같습니다. givehands.co.in 당신이 호스팅하고있는 도메인 인 경우로 변경합니다 : givehands.co.in이 서버에없는, 또는 다른 가상 호스트에 해당되는 경우

RewriteCond %{REQUEST_URI} post/ 
RewriteRule post/ /post.php [L] 

, 다음 방법은 없다 URL을 "다시 쓰려면"브라우저를 리디렉션해야합니다 (Apache가 주도적으로이를 수행하고 있습니다). †

당신 수 실제로 설치 역 같은 것을 할 수있는 프록시,하지만 아마 다른 토론 :