O'Reilly logo

Reguläre Ausdrücke kurz & gut, 2nd Edition by Tony Stubblebine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Beispiele

# /foo zu /bar umschreiben
RewriteEngine On
RewriteRule ^/foo$ /bar
Listing 1.31 Einfaches Matching
# Schöne URL zu Skriptparametern umschreiben
RewriteRule ^/(\w+)/(\d+) /index.php?action=$1&id=$2
Listing 1.32 Matching- und Capture-Gruppen
# Admin-URL auf interne IP-Adressen beschränken
RewriteCond %{REMOTE_ADDR} !192.168.\d*.\d*
RewriteCond %{PATH_INFO}  ^admin
RewriteRule .* - [F]
Listing 1.33 Rewrite-Conditions
# Sicherstellen, dass Admin-URLs über SSL geliefert werden
RewriteCond   %{SERVER_PORT}  !^443$
RewriteRule ^/admin/(.*)$ https://www.example.com/admin/$1 [L,R]
Listing 1.34 Auf SSL umleiten

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required