0

I'm slowly learning mod_rewrite (keyword is slowly) and am using a tutorial's line of code but I'm stumped as to what one of the symbols in the line mean.

RewriteCond %{REQUEST_URI} ^home|^about

What do the ^ characters mean?

86Stang
  • 349
  • 1
  • 4
  • 16

1 Answers1

1

The Apache Regular Expression (or regexp for short) is known as a Perl Compatible Regular Expression (PCRE) engine. If you search the web for PCRE tutorial, you will find hundreds of hits

The ^ character anchors the string to the start of the expression so this means beginning with home or about.

TerryE
  • 10,724
  • 5
  • 26
  • 48
  • Thanks and I'll keep note to search for PCRE tutorials next time. – 86Stang Feb 15 '12 at 23:34
  • If you use PHP, then the PHP help on and offline includes a reference guide. I'd give you a few links, but my problem is that I learnt Perl before there was an Internet, and I only use references for the esoteric regexp stuff now. I did the google search for "PCRE regular expression tutorial and there were a lot of useful hits :-) Have a look at the regexp checker on http://stackoverflow.com/questions/9153262/tips-for-debugging-htaccess-rewrite-rules – TerryE Feb 16 '12 at 00:05