Search code examples
apache.htaccessmod-rewritemybb

Required from one URL to another including the query strings


I just can't figure out the way to redirect all the URLs from http://moneycodeking.com to http://seosatanforum.com.

I found a piece of code with Google and it does work but redirects just the homepage, but not when URL contains query, for example:

moneycodeking.com WILL load seosatanforum.com.

but www.moneycodeking.com/showthread.php?tid=244 won't load www.seosatanforum.com/showthread.php?tid=244

Any help is highly appreciated.

My .htaccess had:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*) http://www.seosatanforum.com%{REQUEST_URI} [R=301,NC]

But it returned loop error said redirection kept repeating.


Solution

  • If both Domains are on the same server, you can use this :

    RewriteEngine on
    
    
    
    RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$
    RewriteRule ^(.*)$ http://newdomain.com%{REQUEST_URI} [NE,L,R=301]