Archive for the ‘RegEx’ Category

HTTP Redirect using htaccess

To redirect all incoming traffic to a new site and send an http status code indicating that the content has moved permanently, use the following snippet in your .htaccess file:
 RedirectMatch 301 ^(.*)$ http://www.mynewsite.com/
The 301 code is the status for permantly moved content. The regex ^(.*)$ matches all urls and finally http://www.mynewsite.com/ specifies where visitors must be redirected [...]

More »

Regex to match all uri’s (http, ftp, mailto)

Very usefull regex for finding and replacing all uri’s in a document…
((mailto\\:|(news|(ht|f)tp(s?))\\://){1}\\S+)

More »