Cannot mask WordPress page URL using .htaccess

.htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp_test/
RewriteRule ^index\.php$ - [L]

RewriteRule ^the_image$ wp-content/uploads/2019/01/banner\.jpg [L]
RewriteRule ^the_page$ sample-page [L]
</IfModule>

When I go to example.com/the_image it shows the correct image. However, if I go to example.com/the_page it shows the page not found page.

Any work around on this?

3 Answers
3

Please make sure your permalinks are set up as /%postname%/(Post name).
You can do this in the Admin by navigating to Settings > Permalinks.

Leave a Comment