Transferring files from a local Xampp or Wamp environment to a live domain.
After developing a WordPress website and setting up your project with data, you need to transfer those files to a live server.
Using Filezilla, you could upload your entire public folder or you could start with a fresh WordPress installation and upload the theme, plugins, media and database.
Once all the physical files have been uploaded, the following changes need to be made:
- Export database
- Change the database connections in wp-config
- Change the site name and URL of the website
- Change the URL of your links and image in your post content
- Configure your .htaccess file for https
- Update the permalinks
Change the site name
UPDATE wp_options SET option_value = replace(option_value, 'http://localhost.com', 'https://domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
Path to links and images
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://localhost.com', 'https://domain.com');
WordPress Post Meta and Guid
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://localhost.com','https://domain.com');
UPDATE wp_posts SET guid = REPLACE (guid, 'http://local.com', 'https://domain.com');
.htaccess file for http to https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress