Answer the question
In order to leave comments, you need to log in
Wordpress + HTML files: how to make a redirect?
Good day.
There is a site on Wordpress. Wordpress is installed in the root directory. And there are HTML files that lie in the /html/ folder. You need to make sure that template dynamic WP and HTML pages from the /html/ folder are also available (but no html in the url).
Can you please tell me the best way to implement this?
I thought about a redirect in .htaccess, but I don’t know something yet, maybe there are other options.
Answer the question
In order to leave comments, you need to log in
The rule for the /html/ folder should be placed above the WordPress CNC rules.
RewriteCond %{DOCUMENT_ROOT}/html/$1.html -f
RewriteRule ^([^/]+)$ /html/$1.html [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question