WN,
Have you read the sticky post OR the mod_rewrite tutorial linked in my signature (a better version of the sticky posts)? That would have answered the question for you.
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^/(.*)$ aa_redirect.php?name=$1
That won't work simply because it's loopy code (and Apache 2 refuses/refused to match the leading /).
[standard rant #1]The use of "lazy regex," specifically the

EVERYTHING

atom, (.*), and its close relatives, is the NUMBER ONE coding error of newbies BECAUSE it is "greedy." Unless you provide an "exit" from your redirection, you will ALWAYS end up in a loop!
[/standard rant #1]
Okay, specification:

Originally Posted by
WorldNews
sarah => aa_redirect.php?name=sarah but NOT about_us.php
Your specification is insufficient as "sarah" is likely to be a variable. Above, you've constructed the variable with ONLY lowercase letters. This is easily differentiated from about_us.php by both the _ and the dot character. However, mod_rewrite provides a "safety value" in that it allows you to check whether the request was for a file which exists. Taking advantage of these "refinements,"
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f # to check on an existing file
RewriteCond %{REQUEST_FILENAME} !-d # to check on an existing directory
RewriteRule ^([a-z]+)$ aa_redirect.php?name=$1 [L]
If you're not sure what version of Apache you're using, replace the ^ (or your ^/) with ^/? as this will work with both Apache 1.x and Apache 2.x.
Regards,
DK
Bookmarks