Reputation: 89
Good afternoon!
I am creating a rewrite rule that will forwards the example1.tv domain my client purchased to URL generated by one of our vendors at https://www.example2.tv/SiteName#broadcasts
The problem that I am having is that, even with the # char escaped, the URL rewrites to https:// www.example2.tv/PageName%23broadcasts which results in a 404. I've changed the URLs for confidentiality's sake, but here is the rewrite rule as I've written in the .htaccess file. Any help would be appreciated!
RewriteEngine on
RewriteCond %{http_host} ^(www.)?(example1).tv [nc]
RewriteRule ^(.*)$ http://www.example2.tv/PageName#broadcasts [r=301,nc]
Upvotes: 2
Views: 439
Reputation: 785156
You can use:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example1\.tv$ [NC]
RewriteRule ^ http://www.example2.tv/PageName#broadcasts [R=301,L,NE]
NE
(no encode) flag makes sure to send #
literally to clients.
Upvotes: 2