YAMRQ (Yet Another Mod Rewrite Question)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux