I have transferred an old “htm” site to wordpress and I need to redirect the old htm domains with “named anchors”.
I have successfully redirected the “htm” to “/”.
E.g: “page.htm” ii redirecting to page/
However I need help redirecting “page#art” to “page/#art”.
What I have right now doesn’t work in IE and Safari.
Here is my current code”
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*).htm$ $1/ [R=permanent,L]
php_value max_execution_time 600
php_value memory_limit 256M
BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
END WordPress
domainname.org/page.htm redirects to domainname.org/page/
and also:
domainname.org/page.htm#art redirects to domainname.org/page/#art
You can’t do this at the server. The
#art
is a page anchor which is used by the browser to position the view on the page. This isn’t passed by the browser to the server, so this anchor info isn’t available to the rewrite engine.