httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ajai Khattri <a...@bitblit.net>
Subject [users@httpd] YAMRQ (Yet Another Mod Rewrite Question)
Date Wed, 03 Oct 2007 21:42:15 GMT

Im struggling with getting my URL rewriting rules working, basically I 
want to have certain URLS to redirect to a different host and I also want 
the inverse case (i.e. if the URL is NOT any of those URLs then redirect 
back to the original host).

So, the first case is for the two /create and /edit URLs:

  RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
  RewriteCond %{REQUEST_URI} ^/create$
  RewriteRule (.*) http://edit.example.com/create [L,R]

  RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
  RewriteCond %{REQUEST_URI} ^/edit/(.*)$
  RewriteRule (.*) http://edit.quamut.com/$1 [L,R]

Those work just fine.

Now, you would think the inverse of these rules would work to redirect 
back to the original host but they dont work (in fact, the next two rules 
break the first two rules - if I comment these out, the first two rules 
start working again):

  RewriteCond %{HTTP_HOST} ^edit\.example\.com [NC]
  RewriteCond %{REQUEST_URI} !^/create$
  RewriteRule (.*) http://www.example.com/$1 [R,L]
  
  RewriteCond %{HTTP_HOST} ^edit\.example\.com [NC]
  RewriteCond %{REQUEST_URI} !^/edit/(.*)$
  RewriteRule (.*) http://www.example.com/$1 [R,L]


Any ideas what am I missing here?


-- 
A


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message