Link to home
Start Free TrialLog in
Avatar of bswinnerton
bswinnertonFlag for United States of America

asked on

Anchor instead of comment in htaccess

Is there a way in an htaccess file to interpret the # literally, and not as a comment?

For example I'm using mod_rewrite and I'd like to take all incoming links to a particular folder, and redirect them to a certain page with an anchor at the end.

Something like this:

RewriteRule ^blogposts/([^/\.]+)/?$ blogposts/index.php?title=$1#$1
ASKER CERTIFIED SOLUTION
Avatar of miahi
miahi
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bswinnerton

ASKER

Hmm, I'm having a little bit of trouble because my browser is thinking that the %23 is part of the variable that I'm passing.

For example, if I echo $_GET['title'] I get the entire title and then #title right after it. Is there a way to signify the end of passing a variable? Or is there another solution?
P.S. this only happens if I type %23 in the browser, if I use the actual pound sign, it works fine
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial