I would like to redirect my old domain to new domain. I'm using WordPress on both domains. But my problem is whenever I try to upload .htaccess file for old domain folder, it instantly get deleted and won't show up in root folder. I'm sure what's causing this issue. Is there any other way to 301 redirect my old domain or how would I make sure that .htaccess file get uploaded in root folder.
there's something on your server deleting the .htaccess.. so just ask your host support about it.. you can do the 301 redirect by simply creating a blank index.php with the code: <?php header('Location: http://www.mynewdomain.com/'); exit; ?> Code (markup):
Your host surely has a file manager of some kind... if you browse through that you will see your .htaccess file, plus you should be able to edit it from there if needed. Alternatively, your domain provider should have a system in place where you can redirect domain names, look for Domain Forwarding or wording like that. This method will also eliminate any additional hosting costs, you might be incurring. Note! if you use your domain providers system to redirect a domain, its usually automatic but you may need to reset your nameservers to match your domain providers.
You can use the php code: <? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.new-url.com" ); ?>