Tuesday , February 4 2025

How to host Wp site in a separate folder of the domain

This article is about moving a site to an internal folder of another site.

1. Transfer site files to a new folder.

2. Export the database, in the dump change the old domain to the new one (with the folder name).
For example, newdomainname.com/folder (Important! Do not put a slash at the end, you need just change olddomainname.com to newdomainname.com/folder and that’s it!)

Import the modified dump into an empty database. If it is not possible to make changes to the dump locally, upload the old dump to the server and recursively replace the old domain with the new one (with the folder name).

3. Edit the wp-config.php file, enter new data: database name, username, password for the database and the connection host.

4. Edit .htaccess, there you need to make 2 edits, according to this example:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /folder/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /folder/index.php [L]
</IfModule>
# END WordPress

About iryna

I'm Iryna, a web developer from Ukraine with a decade of experience solving complex technical challenges in the world of freelance. Throughout my career, I've worked on everything from troubleshooting server-side issues and optimizing website performance to enhancing user interfaces. On this blog, I share detailed solutions to the technical problems I’ve encountered and methods that have worked best for me. In addition to my technical expertise, I’m also passionate about digital drawing. I hope the tutorials and insights I provide here will help both fellow developers and creatives alike in their own projects.

Check Also

How to remove 404 //fonts.gstatic.com and //fonts.googleapis.com from WordPress head section

I tried solutions with functions that should remove from head and , but a very …

Leave a Reply

Your email address will not be published. Required fields are marked *