This is for WordPress but can be used in any site because it uses .htaccess
.
I needed to redirect all visitors that visit the root URL (for example elcoderino.com
) to specific subpage (eg elcoderino.com/subpage
). WordPress allows you to create a static front page or select a custom page that will replace default front page content but in my case it just didn’t work. Maybe it was combination of Advanced Custom Fields or custom post types but it just kept messing up the front page.
So the solution is to add this to your .htaccess
file:
RewriteEngine On RewriteRule ^$ /subpage/ [R=301,L]
if your .htaccess
file already contains RewriteEngine On
then simply just add RewriteRule ^$ /subpage/ [R=301,L]
below it.