htaccess redirect a new address with anchor

I need at the opening a address,

   http://mysite.com/page.php

happened redirected to this address:

   http://mysite.com/other_page.php#!blablabla

tell please, how to make this with .htaccess file ?

Upvotes: 1

Views: 322

Answers (1)

Alireza
Alireza

Reputation: 1438

By default, special characters, such as & and ?, for example, will be converted to their hexcode equivalent. Using the [NE] flag prevents that from happening.

RewriteRule ^/anchor/(.+) /bigpage.html#$1 [NE,R]

The above example will redirect /anchor/xyz to /bigpage.html#xyz. Omitting the [NE] will result in the # being converted to its hexcode equivalent, %23, which will then result in a 404 Not Found error condition.

see also this question:

Htaccess redirect

Upvotes: 2

Related Questions