Miguel.nz

Rewrite url and append hashtag for pages

June 16, 2014

I was trying to redirect some url on one of my WordPress projects for the following rule: domain.co.nz/about/everything to domain.co.nz/about#everything

So I added the following rule on my .htaccess

RewriteRule ^about/([a-zA-Z0-9_-]+)$ about#$1 [R=301,NE,L]

This will work if mod_rewrite is enabled.

Further reading: