admin管理员组

文章数量:1122846

I have a portfolio site that I would also like to make a demo site for some of my client work. Basically, I would like to serve a subfolder statically along side the WordPress install. For instance, if I have .html that index file would be served directly from Apache rather than WordPress. I have root access to my server, just not sure how to implement this

I have a portfolio site that I would also like to make a demo site for some of my client work. Basically, I would like to serve a subfolder statically along side the WordPress install. For instance, if I have http://example.com/demo/subfolder/index.html that index file would be served directly from Apache rather than WordPress. I have root access to my server, just not sure how to implement this

Share Improve this question edited Nov 24, 2018 at 14:22 fuxia 107k38 gold badges255 silver badges459 bronze badges asked May 12, 2015 at 14:57 user379468user379468 1631 gold badge1 silver badge4 bronze badges
Add a comment  | 

4 Answers 4

Reset to default 9

If the files are static HTML, then you only need to be concerned with name collisions for the directory structure. And if you don't have anything in WordPress that generates /demo/subfolder/ you don't have to worry about ignoring it - it's already ignored.

I have a sandbox folder that I use for a similar purpose as you and haven't had to implement anything - It's ignored by WordPress already.

For anyone with the same question, you can use my plugin available at Wordpress repository: WP Custom HTML Pages

It allows you to serve static HTML pages at custom URI of your choice.

1) Install and activate the plugin

2) Use the new submenu item (Pages->HTML Pages) to create a new HTML page

3) In "Page Permalink" field enter the custom URI you wish to assign to your page, for example /my-html-page (at the time of writing this answer, it is required that the value you enter starts with "/" character) and in "HTML Page Code" field enter all the HTML and CSS of the page document that you wish to display

4) Click "Publish" then go to yourwebsite.com/my-html-page and you should see your static HTML page, providing its status is set to "published"

By creating and linking several pages you may have a whole static website.

You can request WordPress to ignore the subdirectory structure by adding these rules in .htaccess. Add them within <Ifmodule mod_rewrite.c> But generally if there is no page such as demo, WordPress ignores it and the static page is rendered.

RewriteCond %{REQUEST_URI} ^/Demo_directory/(.*)$

Old thread, still for someone if needed. This can easily be done using Serve Static =>(https://wordpress.org/plugins/serve_static/) plugin. This automatically creates raw static HTML files, and serves them to visitors.

本文标签: directoryHow do I serve static content on same domain as WordPress