Jump to content

RewriteRule in htaccess for a URL containing the character "#"


thestars

Recommended Posts

Hi,

 

I have a problem with URL  RewriteRule with my .htaccess file. ie. I need to redirect to a Url containing the special character "#" (Example:www.example.com/#id) from an html page. When "#" is given direcltly , it is redirected to

www.example.com/%23id and resulting "a page not found" error page.

The rewrite rule I used is

Options +FollowSymLinks

RewriteRule ^test.html$ /#test/ [R=301,L]

Please anyone help. Thanks in advance.

Link to comment
Share on other sites

Hi,

 

I have a problem with URL  RewriteRule with my .htaccess file. ie. I need to redirect to a Url containing the special character "#" (Example:www.example.com/#id) from an html page. When "#" is given direcltly , it is redirected to

www.example.com/%23id and resulting "a page not found" error page.

The rewrite rule I used is

Options +FollowSymLinks

RewriteRule ^test.html$ /#test/ [R=301,L]

Please anyone help. Thanks in advance.

 

Your "real" url wont exist anywhere. So you saying you have a directory like this?

 

http://site.com/#test/

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

The url is the home page of my site and #id is the id of a <div> tag  in my home page. ie I need to redirect to a specific section in my home page. My site is built in wordpress. Its home page url is http://www.example.com/.

So Whenever http://www.example.com/test.html comes, it needs to be redirected to http://www.example.com/#id.ie to the <div id="id"> section of my home page.

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.