How to Default your WordPress Site to a Non WordPress page
To change your default index to a page out side of WordPress on on a site that has WordPress installed you should:
- Edit the theme functions.php file and add the following line
- Edit the DirectoryIndex of the .htaccess file in the webroot like this:
Why would I want to change my
Sometimes you want to add WordPress to your website but you do not want the website to default to WordPress. For instance, I am working with a website that was created entirely in static HTML. The site owner wanted to completely overhaul the site using WordPress. He hired a company to create a nice new theme. He moved all of the content over to the new site, tested it on the staging server and all was well and good.
I was asked to move the new website over to the live server with as little downtime as possible. My plan was to move the WordPress site over to the live server, test it on the live domain while still serving the original website to the public. If and when the new WordPress site was thoroughly tested, we would change the default page of the domain to ‘index.php’ rather than the original ‘index.html’.
We ran into a problem… When you install WordPress on a domain, it automatically redirects the default page the default WordPress permalink. I thought I could simply add the following to the .htaccess file “DirectoryIndex index.html” but it proved to not be as simple as that. I also tried commenting out all of the WordPress syntax in the .htaccess file but the site still defaulted to the default WordPress page. It turns out I had to edit the theme functions.php file adding the following command:
Then I added the following code to the .htaccess file in the webroot:
I am sure there are many other reasons you may want to default to a page outside of WordPress… feel free to comment below giving reasons you can think of.