2012-01-14 10 views
0

私はthinkingmonkey.methinkingmonkey.comの2つのURLには、両方ともip-address 127.0.0.1(A.K.A localhost)というURLがあります。mod_rewrite `リダイレクト` how?

thinkingmonkey.comにすべてのリクエストをthinkingmonkey.meにリダイレクトしたいとします。

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot /mysite 
    ServerName thinkingmonkey.me 
    ServerAlias www.thinkingmonkey.me 
    ErrorLog logs/dummy-host.example.com-error_log 
    CustomLog logs/dummy-host.example.com-access_log common 
    Options -Indexes +FollowSymLinks 
    RewriteEngine On 
</VirtualHost> 


<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerName thinkingmonkey.com 

    Redirect thinkingmonkey.com http://thinkingmonkey.me/ 

    # Redirect/http://thinkingmonkey.me/ #have even tried this 

    ServerAlias www.thinkingmonkey.com 
    RewriteEngine on 
</VirtualHost> 

私はthinkingmonkey.com URLがthinkingmonkey.meにリダイレクトされませんアクセスしようとします。ブラウザのアドレスバーにあるURLはthinkingmonkey.comのままです。

私は間違っていますか?

RewriteEngine On 
RewriteCond %{HTTP_HOST} !.*thinkingmonkey\.me$ 
RewriteRule ^/(.*)$ http://thinkingmonkey.me/$1 [R] 

ドキュメント:

+1

*そう*多くの重複:あなたは本当に、本当にあなたがthinkingmonkey.comVirtualHostセクションに次の行を置くことができるmod_aiasを使用したい場合は

Options +FollowSymLinks -MultiViews RewriteEngine on RewriteCond %{HTTP_HOST} ^(.*\.)?thinkingmonkey\.com$ [NC] RewriteRule^http://%1thinkingmonkey.me%{REQUEST_URI} [L,R=301] 

:あなたは、次のコードを使用することができます。 –

答えて

1

mod_rewriteのは、これらの書き換えを処理するために、より良く、より強力なと考えています。

Redirect 301/http://thinkingmonkey.me/ 
関連する問題