• Is it possible that the domain.com is a blog and domain.com/folder/ contains a html site that loads perfectly without errors. I tried it but gives 404 errors because that url is taken as blog’s part.

    It should be possible with htaccess modification.

    Is there a htaccess command which just ignores the html, htm call. And the rest blog posts with permalinks like domain.com/this-is-a-post/ load fine and so do domain.com/folder/my-html-page.html

Viewing 8 replies - 1 through 8 (of 8 total)
  • not sure if it will work but try putting an .htaccess file in domain.com/folder/
    that contains the line
    DirectoryIndex index.html

    what that means is, when the URL being accessed is
    https://domain.com/folder/
    Apache will serve up https://domain.com/folder/index.html
    So, if your homepage on the static site is not index.html, use the filename of your homepage in that line instead of index.html

    This htaccess file should go in domain.com/folder/ not in your WP install folder

    Thread Starter paritit

    (@paritit)

    It’s ok but what if the folder contains many html pages? Will I have to include every name into htaccess?

    And what if there are 100 html pages inside the folder.

    You shouldn’t need to do anything, html files should load in the sub-directory just fine, have you tried?

    WordPress rewrite snippet:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    The two conditions RewriteCond there only rewrite urls requested that are not ! a file -f and not a directory !-d …so your HTML files should be just fine.

    To add to that, you only need the line in htaccess for the one file. It only applies when someone types in https://domain.com/folder/ – it tells Apache what the default file is. All your links within those 100 pages are to complete URL’s which will be found just fine without needing any redirect code.

    Thread Starter paritit

    (@paritit)

    Just tried it again…NOT WORKING!

    The above two RewriteCond don’t work for the cause!

    Hi

    You are correct – have duplicated the issue here. Am looking into a solution & will post when I get it.

    Strange, i tested before i posted, created a folder, created one .html file (called test.html), loaded the page (mylocalinstall/testfolder/test.html), saw my test text appear..

    The above 2 lines are just a snippet of the default lines created by WordPress, they were not given as example to use..

    Thread Starter paritit

    (@paritit)

    hmmm.. I got the issue now. My html pages are dynamically generated through htaccess + another PHP file inside https://domain.com/folder/

    t310s_ you are indeed correct. Your solution(two original rewrite lines already there in wp default htaccess) works but only if there are actual static files present in folder.

    In my case they are not static files though they are html files so it does not work. I apologize for inconvenience.

    Although my problem still remains – but I think there is a simple solution – a htaccess command that tells not to execute html, htm files through WordPress index.php

    Thanks everybody for their time.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘HTML site in blog’s sub folder’ is closed to new replies.