10-28-2008, 11:55 AM
|
#3 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
It'll probably make more sense to use a regular expression to match short urls and throw them into the redirect page.
Code:
# Turn on URL rewriting
RewriteEngine On
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite to redirect.php
RewriteRule ^[a-z0-9_-]{4,7}$ redirect.php?url=$0 [NC,L]
Of course, the pattern might need changing to suit your own application as the one above might be a little too loose (or tight!) in what's allowed or not (alpha-numeric, underscore or dash between 4 and 7 in length (inclusive)).
|
|
|
|