Wordpress - Prevent redirection to main URL - wordpress

I tried to copy the files of a WordPress website on another domain of mine.
But it keeps redirecting to the old domain name.. I'm not a WordPress expert and it's also not my website - that's why I don't have a GUI and only the files.
How and where can I disable the redirection to the main domain in the files? I can't seem to find it.
Thanks for the efforts.
For example:
WordPress website "test.com" copy paste --> "testtest.com"
"testtest.com" redirects to --> "test.com" when entered in URL

When you transfer a Wordpress install to a new domain, there are 2 values you need to update in your database. One is the homeurl and the other is the siteurl. Typically these changes would be made directly in the database, either by modifying the sql file before importing it on the new server or by accessing the database using PHPMyAdmin or some other form of database management software. However, in the event that you don't have access to the database or do not want to make the change in the database, you can also override the settings in your wp-config.php file using the following options:
define('WP_HOME','https://yourdomain.com');
define('WP_SITEURL','https://yourdomain.com');

Related

Moving WordPress from subdomain to main domain

I’ve read the WordPress Codex instructions regarding moving WordPress, but none of the information provided seems to apply to my exact situation and I have a couple of questions before I go and break things.
I have a main domain on which my old wordpress site is currently running (e.g - example.com) I wanted to change the layout of the website but at the same time wanted to keep my main site running so made a subdomain (beta.example.com) and created my new wordpress website on this.
Now I want to make my beta website the main website (i.e make beta.example as example.com) and remove the main website, how do I go about that?
I am using cpanel and both my folders are in the public html directory
Thanks in advance.
Step 1: Backup: Always backup the files / database of the site(s) you choose to work with
Step 2: Move files: Delete the contents of example.com's document root and move the contents of blog.example.com to example.com
Step3: Change home/site-url: The daabase mght have other hard coded urls too. So changing the home / site url alone will not be enough and a full database search-replace is needed.
I would not recommend using notepad++ or any text editor to change the website url as it has a great chance to break the layout of the website and I have seen it may times happen. I always use and recommend you to use the Database Search and Replace Script from here
Download the version 2.1.0 to the document root of the website as search.php
Now call the script via your browser (as domain.com/search.php). The script autopopulates the database details. The rest of the instructions there are self explanatory to follow.
Step 4: Finishing up: Check the .htaccess file that there are no redirects to the blog.example or similar redirects. If yes, remove them and replace with the default .htaccess wordpress rules.
That should do it.
Steps are below:-
Make a new folder into your root in Cpanel and move your old domain(example.com) files to the new folder as a backup
Move your subdomain (beta.example.com)folder's files into root in cpanel
rename your ht access file it will automatically created when your WordPress run into the browser.
Into your PHPMyAdmin create new database (like new_database)
Download your subdomain database and open it into editor something (like notpad++)
Into notpad++ press crt+f, from tabs click to replace, into find section put beta.example.com and into replace with section put example.com then save it make sure you do not use HTTP, https or www when performing the replacing task.
Now goto your WordPress directory wp-config file and change your database name with newly created one username and password too.
Visit example.com/wp-admin login there with your login details you were using to login into beta.example.com/wp-admin.
Into deshboard->setting click to permalinks and select %%postname%%
Thanks, I hopes it will work for you as example.com

moving WordPress over to domain, after working on it locally through MAMP

I've finished the styling changes on WordPress and I'm ready to move it from MAMP to my domain.
Will this involve any changes to the WordPress files or can I just drag it over to my new domain once I purchased it?
The main start you must make is update your wp-config.php
define('WP_HOME','http://www.mynewdomain.com');
define('WP_SITEURL','http://www.mynewdomain.com');
That way wordpress knows what domain it MUST run from.
The reason you do that is because without this you may not be able to access admin, login, etc etc.
When this is working and you have logged in, go to wp-admin and go to your permalink settings.
Make a NOTE of your settings, then change them to default (and woocommerce settings etc).
Go to your home page and a few others, and notice how messed up your urls look :)
Now go back to permalink settings and restore them (the point of this is to make sure your .htaccess file that wordpress depends upon is set correctly)
Finally, have a look at https://github.com/veloper/WordPress-Domain-Changer to change your sql etc if needed.
note this method is very handy for developers so you just update your wp-config.php for localhost or development or production (not for testing purposes, don't use your local pc. copy it all up to a subdirectory of your hosting partner e.g. http://www.mynewdomain.com/mytestarea. Make sure you use a COPY of the mysql database (never point both to the same database). You now can test on the hosting platform without disturbing the live site or your development causing issues to other people.
It's been a long while for me personally, but you'll want to change the SiteURL via the options menu in wp-admin.
Otherwise, just make sure your MySQL database is exported over, your credentials and user permissions are all setup and those work too.
If you still have problems:
https://codex.wordpress.org/Changing_The_Site_URL
https://codex.wordpress.org/Moving_WordPress
The database has to be updated. What always works for me is that I export the database from phpMyAdmin or MySQL (using mysqldump) and open the exported .sql-file with a text editor, like Sublime Text.
Now you want to find any occurence of your previous URL. Let's say on your dev machine the URL to the index of your Wordpress site is http://localhost:8080/wordpress and you want it to be on a website under https://domain.com you simply do a Find & Replace using that and replace everything with https://domain.com.
For older Wordpress versions you have to update the .htaccess files if you have custom URL's.
You have to make a search replace in your database and replace your local domain ( test.lo ) with the live domain ( test.com ).
To do this you can use the script from here: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Add the searchreplacedb2.php file in your route folder and the access test.lo/searchreplacedb2.php and follow the steps there. This will replace your local domain with your live one everywhere in the database.
You can't make a simple search-replace because the local domain might be serialized in some fields in the database, and a simple search-replace will not replace those.

How to upload wordpress theme to sub domain

In my localhost(xampp) wordpress themes are installed. I activate one of them And create user name and password for the wp-admin.
And I backup database and wordpress site and upload it to subdomain(live site). After upload all content will load without CSS style-sheet. And wp-admin also not working. And url as same baseurl twice.
Question is How to upload my wordpress site to my subdomian. Clear me out. Am i missing some thing??
This is pretty much what you are looking for: Moving WordPress
It´s a quite detailed manual how to move WordPress Sites/Blogs from one server to another and moving from localhost to a live server is not much different.
If you are trying to move a complete Wordpress site from one server to another I would recommend using the plugin Duplictor.
https://wordpress.org/plugins/duplicator/
Really easy to use and does the job excellent!
I do blogging a bit. I found this video tutorial, I have used this one to successfully set up a new subdomain and install Wordpress sometimes ago.
STEPS::
Use cpanel to create the subdomain
Download the latest version of wordpress to your local drive
Upload to subdomain folder on your host
Extract the files, and move them into the subdomain folder
Use cpanel DB Wizard to create a new data base
Make a note of the username, db name and db password
Copy wp-config-sample.php to wp-config.php in the subdomain folder
Edit wp-config.php to add the username, db name and db password
Open the URL "your-subdomain.your-domain.com/wp-admin/install.php"
Fill out the fields on the form and press "install wordpress"
After creating the a subdomain, use WP clone to create and install a backup of my live site into the new subdomain. The clone site allows you to verify updates before deploying them to your public site.
Hopefully the issue has resolved already, but maybe this will be of use to others.
Thanks.
If you are trying to move a complete Wordpress site and is without plugin,
copy all the wordpress files in the htdocs/project-name to the
subdomain folder.
Then export the db from phpmyadmin,open it in an editor
Change all the url of the format 'http://localhost/your-project-name'
to the subdomain link(http://eg.example.com).
Save it and import the sql file to the subdomain's db
Change the database,username,password in wp-config of the subdomain
with subdomain's db details.
http://codex.wordpress.org/Installing_WordPress#In_a_Subdirectory
Wordpress codex gives you the steps for doing this.

Copy Wordpress site to another domain

I have two domains (mysite.com and mysite.net) which share the same IP address. I can see that in my host control panel. I've created a Wordpress site on mysite.com, beforehand installing Wordpress using FTP. Now I want to have the same wordpress site on mysite.net, which will have the same content in different language. How can I achieve that?
You can copy the files to the other site. Then export the database, find/replace 'mysite.com' with 'mysite.net' and import it into the database for mysite.net. Modify your wp-config.php file to refer to the new database.
Then, on mysite.net/wp-admin, go to Settings->Permalinks and save it. This will reset the rewrite rules and create a new .htaccess file (when writable).

Wordpress pages won't load after hosting transfer

I've just transfered a wordpress website to another domain.
For the transfer I've made the following steps:
Copied db and changed domainnames (http://olddomain.com to http://newdomain.com)
Imported db on new host (via phpMyadmin)
Changed wp-config to match new db settings
uploaded all wp files
So the homepage works, but I can't visit the other pages. However, they are showing up in my admin page.
The way I've done this in the past and have worked for me:
1- Export db from phpMyAdmin, then replace in the .sql file all references to old domain.
2- Imported db on new host (via phpMyadmin)
3- Changed wp-config to match new db settings
4- Uploaded all wp files
5- Regenerate .htaccess file, if you are using permalinks.
(you can do this the way #Riboflavin suggests)
Also, here you can find some additional information that could help:
http://codex.wordpress.org/Changing_The_Site_URL
If you are using permalinks you will need to regenrate them after the transfer. Go to Settings → Permalinks in your admin panel and choose the permalink option you would like to use and click Save Changes. This will regenerate the permalink portion of your .htaccess file for your new domain.
Are the links to those other pages still pointing to the old domain?
If so, you could try the Velvet Blues Update URLs plugin to update all the links in your site.
I've used this successfully in the past, but recommend that you back up your data fully before trying it yourself.
The fastest transfer from my experience is through cpanel using fantastico or something that installs wordpress quickly. The process is as following:
Install wordpress on new hosting through fantastico or similar app
Delete everything in installed directory except for wp-config
Copy everything from old wordpress data, except for wp-config
Paste/transfer all that data to the new host
Now export old database and delete tables on the new one then import from old db
Change site URL within database to new one
Using fantastico helps in setting up databases quickly and wp-config. No need to do it manually and waste time. Just make sure to leave the installed one and not transfer the old one.
The whole process takes me like 2-3 minutes, I think its the fastest once you get it.
You need just to adjust your new .htaccess by regenerating it
go to WordPress dashboard
Settings > permalinks
then save modifications
if it's work then well done else you need to manually change it :
you will find the .htaccess content after saving modification in permalinks page copy the contents and create the .htaccess file in the root directory

Resources