Re: YAMRQ (Yet Another Mod Rewrite Question)

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

 



Hey Aj.,

So you are running www.example.com and edit.example.com
within the same apache server config? This means edit.example.com
is an alias to www.example.com or how do you set/determine
HTTP_POST?

When working with multiple hostnames/servernames and treating
traffic differently depending on a this name, it makes
sense to work with multiple name-based virtual hosts.

See http://httpd.apache.org/docs/2.0/vhosts/name-based.html

I am not exactly sure what is going wrong with your server,
but the following abbreviated config layout should solve it
(and bring you a more readable config):

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName www.example.com
  
  RewriteEngine On
  RewriteRule /create(.*) http://edit.example.com/create$1 [redirect,last]
  RewriteRule /edit(.*)   http://edit.example.com/edit$1 [redirect,last]
  
</VirtualHost>

<VirtualHost *:80>
  ServerName edit.example.com
  
  RewriteEngine On
  RewriteRule /create - [last]
  RewriteRule /edit - [last]
  RewriteRule ^(.*) http://www.example.com/$1 [redirect, last]

</VirtualHost>

Hope this helps.

Christian





On Thu, Oct 04, 2007 at 08:16:04AM -0400, Ajai Khattri wrote:
> On Thu, 4 Oct 2007, Christian Folini wrote:
> 
> > I am missing the context. :)
> >
> > Please provide your whole config. I think it has to
> > do with the structure of your config file.
> 
> This is the .htaccess file:
> 
> Options +FollowSymLinks +ExecCGI
> 
> <IfModule mod_rewrite.c>
>   RewriteEngine On
> 
>   # redirect creation and editing actions
>   RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
>   RewriteCond %{REQUEST_URI} ^/create$
>   RewriteRule (.*) http://edit.example.com/create [R,L]
> 
>   RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
>   RewriteCond %{REQUEST_URI} ^/edit/(.*)$
>   RewriteRule (.*) http://edit.example.com/$1 [R,L]
> 
>   # likewise, redirect back for actions that are NOT edit/create
>   # this doesn't work
>   #RewriteCond %{HTTP_HOST} ^edit\.example\.com [NC]
>   #RewriteCond %{REQUEST_URI} !^/create$
>   #RewriteCond %{REQUEST_URI} !^/edit/(.*)$
>   #RewriteRule (.*) http://www.example.com/$1 [R,L]
> 
>   # for TinyMCE and images folder
>   RewriteRule ^js/tiny_mce/plugins/imagemanager/(.*)$ - [L]
>   RewriteRule ^images\/(.*)$ - [L]
> 
>   RewriteCond %{REQUEST_URI} \..+$
>   RewriteCond %{REQUEST_URI} !\.html$
>   RewriteRule .* - [L]
> 
>   # we check if the .html version is here (caching)
>   RewriteRule ^$ index.html [QSA]
>   RewriteRule ^([^.]+)$ $1.html [QSA]
>   RewriteCond %{REQUEST_FILENAME} !-f
> 
>   # no, so we redirect everything else to our front web controller
>   RewriteRule ^(.*)$ index.php [QSA,L]
> </IfModule>
> 
> # big crash from our front web controller
> ErrorDocument 500 "<h2>Application error</h2>application failed to start properly"
> ErrorDocument 401 /error/401.html
> 
> 
> 
> -- 
> Aj.
> 
> 
> 
> ---------------------------------------------------------------------
> 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
> 

---------------------------------------------------------------------
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