2014-09-02 2 views
1

나는 2 개의 wordpress 웹 사이트가있다 새로운OLD with permalinks. OLD 웹 사이트는 http://website.com/old이고 NEW는 http://website.com입니다.Wordpress는 나의 IP를 제외하고 모두 방향을 바꾼다

내 IP를 .htaccess를 사용하여 OLD 웹 사이트 (http://website.com/old)로 리디렉션하고 싶습니다.

주요 directorie (http://website.com)에있는 기본 htaccess로는 다음과 같습니다

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

내가이를 변경 한 다음 (xx.xxx.x.xxx 내 IP입니다) :

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteCond %{REMOTE_HOST} !^xx.xxx.x.xxx 
RewriteRule .* http://website.com/old [R=302,L] 
</IfModule> 

이 시점에서 모든 IP 주소를 내 OLD 웹 사이트로 리디렉션 할 수 있습니다.

Not Found 
The requested URL /contacts/ was not found on this server. 
Apache Server at website.com Port 80 

어떤 생각을 : 나는 retuns http://website.com/contacts처럼 내 새로운 웹 사이트에있는 모든 페이지를 탐색 할 때 문제는? 당신은 워드 프레스의 주요 규칙을 유지해야합니다 감사합니다

답변

2

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/

# if not my ip then redirect to old version 
RewriteCond %{REMOTE_HOST} !^xx\.xxx\.x\.xxx$ 
RewriteRule . old [R=302,L] 

# if we're here, it means it's me so display new version 
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . index.php [L] 
</IfModule> 
+1

완벽 IP를 체크! 감사 ;) –

관련 문제