Understanding THE_REQUEST variable in RewriteCond

Viewed 2499

RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/

I understand everything in the line above except for the following segment:

([#?][^\ ]*)?\ HTTP/

I've done some research and found out that the square brackets are used to match any one of the characters within them. However, I have also learned that ? is used to make the preceding token optional and that ^ means "match start."

As such, why do the square brackets in the segment above contain both ? and ^? I thought that the square brackets were simply used as a "character class."

Also, what is the purpose of HTTP/ in the segment specifically? All of my searches have come to no avail.

1 Answers
Related