Reg Expression htaccess RewriteRule
Posted
by
Rick
on Server Fault
See other posts from Server Fault
or by Rick
Published on 2012-07-06T19:35:02Z
Indexed on
2012/07/06
21:18 UTC
Read the original article
Hit count: 296
.htaccess
I am new to using regular expressions for rewriting URL's in htaccess
I need to redirect mysite.com/123 to mysite.com/, IF cookie named 'ref' is set.
my current htaccess is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_COOKIE} ref=true [NC]
RewriteRule ^/([0-9]+)/$ http://www.mysite.com
</IfModule>
The goal is that when someone enters site with: mysite.com/111(some number) that they are redirected to the home page of the site after the cookie is set.
Be nice... I'm new! ;o)
© Server Fault or respective owner