I am facing an issue while I upload the custom HTML page into my Wordpress site.

The page all alone working fine as I put it in separate folder or if I change its name to index.php . But then their arise a conflict between this custom page and the other WP theme pages .If I set this as a index.php page in theme or root WP .This page runs swiftly but other theme pages doesn’t work .Just show the same index page but with broken css

So all I want is not to broke my theme page as well to set custom html page it as my default Home Page How can I achieve this ? I am using divi them

HTML page that I want to set as my Default Home page : http://filmyoze.com/Default

Rest of site : http://filmyoze.com


2 Answers 2


This code may help resolve the issue for this particular situation. Put this code in yor theme's functions.php.

add_action('template_redirect', 'default_page');
function default_page(){
    if(is_home() or is_front_page()){
       exit( wp_redirect("http://path/to/your/html/file"));

Replace http://path/to/your/html/file to exact url of html file.

I hope this helps.

  • Stay blessed, always. Mar 8, 2019 at 21:42
  • can you plz help me out there wordpress.stackexchange.com/questions/331491/…
    – Talha khan
    Mar 13, 2019 at 1:38
  • how about if I have a landing page created from a plugin and I want my homepage to server the content of my landing page. So when I access my site.com, it will just read the content of my site.com/landing_page. I don't want to redirect. Sep 17, 2020 at 4:35

WordPress relies on all WordPress requests being routed to index.php, which kicks off the whole WordPress lifecycle and then serves up the proper page, content, etc. (This is true for everything except requests to other real, existing files, like images and external pages that don't need WordPress.)

If you want your custom page to be the home page of your site, but live within WordPress (which is usually the case), then you need to operate within WordPress's world. That means you don't just stick a file in your directory, and you certainly don't replace WordPress's index.php file.

Instead, you create a page template and a page within WordPress to use it. Basically:

  1. Create a page in WordPress
  2. On your WordPress dashboard, go to Settings -> Reading and for Front Page choose the page you created
  3. In your site's directory, name your file front-page.php
  4. In front-page.php, at a minimum, put the PHP calls to get_header() before your content, and get_footer() after your content

With those steps, WordPress will capture all requests to your home page, and serve the page you created (in step 1) using the template you created (in steps 3 & 4). You can then go further and store front page content (i.e. content, meta data, etc.) on that WordPress page, and pull it into your page template dynamically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.