How do I add an Html page to a wordpress site?
I have a linode set up with wordpress on ubuntu 22.04 using their one-click process.
I've already imported and set up the wordpress site, but I want to add sub-pages, links that are html. I am making a website from an old html site and there are a few pages I'd like to just have as they were on the old site.
I know how to put files on the server, but cannot find a way to "serve" or access them through the web. I've tried making an html directory alongside the wordpress directory, or inside wp-content, but everything I try typing the path just comes up with 404 error.
I can find quite a few tutorials, but they are using "public_html" but my wordpress is in "var/www/" and it doesn't seem to work.
I use winscp to upload files, and I give them the same user and permissions as the wordpress folders.
2 Replies
Why not put you new content into the public_html directory of the domain (assuming that is how you set up your virtual host) which is where your WordPress site files are.
If you want to access these pages from WordPress, the only way I can think to do this is to create a page in WordPress that has a link (Gutenberg editor has 'block' for this) to the html file …. https://my-domain.com/my-file.html.
I haven't used WP for a long time. I believe the URLs are formed by the WP code in connection with database entries.
The way I would do this is to use the same virtual host as your WP site but create an alias to a different physical location. Something like:
<VirtualHost _default_:443>
# Admin email, Server Name (domain name), and any aliases
#
ServerAdmin postmaster@mydomain.com
ServerName mydomain.com
ServerSignature Off
# Let's Encrypt & WP config omitted
Alias "/mypages" "/the/path/to/the/pages"
<Directory /the/path/to/the/pages>
#SSLOptions +StdEnvVars
AllowOverride None
Options -Indexes
Require all granted
</Directory>
</VirtualHost>
The URL https://mydomain.com/mypages/foo.html will point to the the file /the/path/to/the/pages/foo.html. Of course, your WP site probably uses TLS and a cert so you'll have to propagate all that to your <Directory> configuration.
You can create an /the/path/to/the/pages/index.html page (with the URL https://mydomain.com/mypages/) to provide jump off links to the other pages if you like. Just put a DirectoryIndex index.html directive inside the <Directory> configuration.
As always, YMMV… If you're an nginx user, you're on your own…
-- sw