views:

47

answers:

2

Im trying to set up a simple rewrite rule but I dont seem to be able to get it to work. Basically I want to route any address that starts with "restaurants" to a certain place and all other addresses to my bootstrap.

RewriteRule ^/restaurants http://www.google.com RewriteRule !^/restaurants index.php

is what I have so far. ie.

  • mysite.com/restaurants
  • mysite.com/restaurants/blabla
  • mysite.com/restaurants/beep/boop

would all go to google, all other requests would go to index.php

+1  A: 

If you want to use the rules in a .htaccess file, you have to remove the leading / in the patterns:

RewriteRule ^restaurants http://example.com/
RewriteRule !^index\.php$ index.php
Gumbo
+1  A: 

Here is a set of rules that should work

RewriteRule ^/resturants.*   http://www.google.com/ [L] 
RewriteRule !^/index\.php$   index.php

You'll want to specify that the google redirect is last (L) otherwise it will be overridden by the second rule.

Joseph Tary