0

I am working on a regex to match URLs without http, https or ftp in the beginning. Basically, I need it for mod_rewrite:

Examples:

www.someurl.com/blah/blah/balh/etc/and/so/on
crazy.something.net/agjja
something.us/index.php?

So, I can do

RewriteCond %{REQUEST_URI} URLregexhere
RewriteRule ^URLregexhere$ ping.php?url=$1 [L]
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
gwegaweg
  • 33
  • 1
  • 5
  • Duplicate: http://stackoverflow.com/questions/1616770/help-rewriting-this-url-simple-but-not-working – Gumbo Oct 24 '09 at 08:00

2 Answers2

0

You want to match everything?

RewriteCond %{REQUEST_URI} !^/?ping\.php
RewriteRule (.*) ping.php?url=$1
Devin Ceartas
  • 4,743
  • 1
  • 20
  • 33
0

By definition everything that the regex in a RewriteRule is receiving is a URL (since it's fed the URLs for requests, and nothing else), so the match-all regex (.*) is all you need.

Amber
  • 507,862
  • 82
  • 626
  • 550