I am trying to setup page anchors online that utilizes mod_rewrite (Apache2 running on Ubuntu Server 9.04).

My htaccess file appears like this:

RewriteEngine On
RewriteRule ^information.php/([A-Za-z0-9-]+)/?$ information.php?display=$1	[NC,NE]

Basically was using regular URL's the query would look something similar to this: http://mydomain/information.php?display=faq#cost

I am wishing to obtain something similar to this: http://mydomain/information/faq/cost

Is possible? My understanding is the fact that modrewrite ignores page anchors, which the browser handles it? I am speculating will be able to in some way use mod_rewrite to incorporate the anchor information using the request, however i weren't capable of finding anything recording this and also have been trying unsuccessfully to create it myself for hrs.

Thanks!

Really, if you would like the resulting URL with an anchor, then yes, it is possible. Just remember that in Apache configs, # marks the beginning of a comment.

If what you would like is much like this - user makes its way into

http://example.com/page/anchor
and will get rerouted to
http://example.com/?p=page#anchor
- you should use 301 Redirect, or something like that like this, therefore it would not be transparent towards the user.

Conclusion: While you'll be able to write this type of redirect rule, it cannot be achieved entirely server-side. And So I think you can point /information/faq to /information.php?display=faq after which use Web addresses for example:

http://example.com/information/faq#foo
that are almost what you would like, and so they don't screw up caching.

(Whoa, it's night time already?)