Mobile app version of vmapp.org
Login or Join

Login to follow query

More posts by @Jennifer507

1 Comments

Sorted by latest first Latest Oldest Best

 

@Shelley277

since the /#blog consider as the part of the homepage


Everything after the # is called the fragment identifier. This part of the URL (ie. blog in this case) is not actually sent to the server (the browser strips it from the request), so you can't do this sort of redirect in your server-side logic (ie. regular WordPress redirect).

The fragment identifier can only be manipulated client-side. eg. with JavaScript.

There might be (probably is) a WordPress plugin that will do client-side redirects for you, or you can write some JavaScript code. For example:

<script>
if (location.href == 'http://www.example.com/#blog') {
window.location.replace('http://www.example.com/blog');
}
</script>


Note that this is not the same as an HTTP redirect. The client only sees the 200 OK HTTP status, not a 3xx status that is usual (and preferable) with a redirect.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme