I own domain at http://www.mysite.net and recently i have purchased http://www.mysite.com I am using Wordpress. I have transferred all files from old domain to new domain and chaged corresponding posts and pages links in mysql database. Now i am facing problem is that... when user tries to open link, tag or categories its not opened in fact, i want to redirect as follow.. http://www.mysite.net/software-tags must redirect to http://www.mysite.com/software-tags http://www.mysite.net/download-categories must redirect to http://www.mysite.com/download-categories http://www.mysite.net/first-post must redirect to http://www.mysite.com/first-post Anybody have solution ?? I want to do it thorugh .htaccess . See below code that i have tried . but not working well I have latest version of wordpress that is 3.3 # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress RewriteEngine On RewriteCond %{HTTP_HOST} ^.*mysite\.net$ [NC] RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L] PLEASE HELP ME !!
Hey, I had this problem once! Try something like this: Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^mysite.net [nc] rewriterule ^(.*)$ http://www.mysite.com/$1 [r=301,nc] Enjoy!
Check your wp-config.php file to make sure you are not defining the site url or home url there. Look for something like this: define('WP_HOME', 'youroldsite.com'); define('WP_SITEURL', 'youroldsite.com'); PHP: If you see that, just change it to your new domain or delete it if you have updated the values in your .sql file under the options table.
Here goes the solution: Go to root folder of your old domain. Create a .htaccess file (if already exists, just modify it). Put the following code in it. Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] Code (markup): Replace newdomain.com with your new domain. You are set to go
Remember, 301 redirection code must be set to old domain root folder, not in the new domain. So remove all redirection code from the new domain .htaccess file.