You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by james cauwelier <ja...@gmail.com> on 2009/09/24 08:43:54 UTC

[users@httpd] htaccess serving different domain with different front controllers

Hi All,


I am developing a website  which has different front controllers:

- web/index.php for the main website
- web/sioen.php for a copy of the website with different looks

I don 't seem to be able to redirect the correct host to the correct
controller and I am hoping that somebody can help me.
I would appreciate any help and am willing to return the favor in the
form of Symfony Framework or general PHP support.

Here is my .htaccess (I deleted unimportant parts from my colleague),
I suspect the line with [S=1] is to blame:

Options -Indexes

RewriteEngine On

#uitzonderingen
RewriteRule ^plugins/PhpMyAdmin/(.*)$ plugins/PhpMyAdmin/$1 [L]

# subdir web = root
RewriteCond %{REQUEST_URI} !web/
RewriteRule (.*) web/$1 [L]

# redirect only when file not found
RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{HTTP_HOST}  ^sioen.* [S=1]

RewriteRule ^(.*)$ /web/index.php?command=$1 [QSA,L]
RewriteRule ^(.*)$ /web/sioen.php?command=$1 [QSA,L]

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


Re: [users@httpd] htaccess serving different domain with different front controllers

Posted by James Cauwelier <ja...@gmail.com>.
Thanks.  With your explanation, I am sure I 'll get the rules working  
as I want them to.


James

(PS:  ik weet niet wat je bedoeld met Sioen, dus kan ik je daar niet  
echt een antwoord op geven.  )



On Sep 24, 2009, at 1:06 PM, Krist van Besien wrote:

> vanbesien.org


Re: [users@httpd] htaccess serving different domain with different front controllers

Posted by Krist van Besien <kr...@gmail.com>.
On Thu, Sep 24, 2009 at 8:43 AM, james cauwelier
<ja...@gmail.com> wrote:

> Here is my .htaccess (I deleted unimportant parts from my colleague),
> I suspect the line with [S=1] is to blame:

Yes, it is. [S=1] is only valid for a RewriteRule, not a RewriteCond.


> # redirect only when file not found
> RewriteCond %{REQUEST_FILENAME} !-f
>
> RewriteCond %{HTTP_HOST}  ^sioen.* [S=1]
>
> RewriteRule ^(.*)$ /web/index.php?command=$1 [QSA,L]
> RewriteRule ^(.*)$ /web/sioen.php?command=$1 [QSA,L]

I think you better study the order in which Rewriterules and
RewriteCond's get processed.
Have a look here:
http://httpd.apache.org/docs/2.2/rewrite/rewrite_tech.html#InternalRuleset

Basically your request will first be checked against the first
RewriteRule. Since your first RewriteRule rule matches anything it
will trigger, and then the RewriteConds above it are checked. If all
mathches the rule is applied. Since you have the L flag no other rules
are applied after one matches.
The S flag is meant to skip the next RewriteRule, in case a rule
matches. It is only needed if you have some other rules that need to
be applied.

So corrected for syntax your rules look like this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST}  ^sioen.*
RewriteRule ^(.*)$ /web/index.php?command=$1 [QSA,L]

RewriteRule ^(.*)$ /web/sioen.php?command=$1 [QSA,L]

I usually don't put any whitespace between RewriteCond and RewriteRuld
statements, so there is no doubt as to what belongs together.

The above might however not do what you want it to do (judging by your
previous attempt). Most probably you want this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /web/index.php?command=$1 [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST}  ^sioen.*
RewriteRule ^(.*)$ /web/sioen.php?command=$1 [QSA,L]

HTH,

Krist
(Tussen haakjes, is "sioen" wat ik denk dat het is :-)

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

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


Re: [users@httpd] Apache 2.2 + Ldap

Posted by Tom Evans <te...@googlemail.com>.
On Thu, 2009-09-24 at 05:55 -0700, Luis Clemente wrote:
> Hi all,
> 
>    Someone knows how I can setting the apache 2.2. server to authenticated in a Ldap server? Here is my httpd.conf Ldap configuration:
> 
> <Directory /var/www/html>
>   AuthBasicProvider ldap
>   AuthType      basic
>   AuthLDAPURL   "ldap://ldapserver.com:389/o=domain.com?mail"
>   AuthzLDAPAuthoritative on
>   AuthName      "Please sign in with an Internet e-mail ID (IIP) which is in the Postman BlueGroup"
>   AuthLDAPGroupAttribute mail
>   Require       group cn=postman,ou=memberlist,ou=compgroups
> </Directory>
> 
>    I think it is simple but I don't know what is happen. I use my email to authenticated it. If I use the wrong password, the follow message it appears:
> 
> [Tue Sep 22 17:07:32 2009] [warn] [client 9.6.113.47] [8449] auth_ldap authenticate: user luisecc@comp.com authentication failed; URI / [ldap_simple_bind_s() to check user credentials failed][Invalid credentials]
> [Tue Sep 22 17:07:32 2009] [error] [client 9.6.113.47] user luisecc@br.ibm.com: authentication failure for "/": Password Mismatch
> 
>    But if I use the right password nether message it is showed and the authenticated it is not accept.
> 
>    So anyone can help me? Someone knows how to do this?
> 
> Best regard's
> 
> Luis
> 

This is how we have it set up:

AuthType Basic
AuthName "Foo"
AuthBasicProvider "ldap"
AuthLDAPURL "ldap://ldap/o=Foo?mail?sub?(accountActive=TRUE)"
AuthLDAPBindDN "cn=fooclient,ou=System Accounts,o=Foo"
AuthLDAPBindPassword "foopass"
AuthzLDAPAuthoritative "On"
Require valid-user
Require ldap-group cn=IT,ou=Groups,o=Foo

fooclient/foopass are credentials used to look up the user before
authenticating them, IIRC. It is required if your LDAP server disallows
anonymous binds. Probably what you are missing is that you need 'Require
ldap-group ...' not 'Require group ...'.

Cheers

Tom



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


[users@httpd] Apache 2.2 + Ldap

Posted by Luis Clemente <lu...@yahoo.com.br>.
Hi all,

   Someone knows how I can setting the apache 2.2. server to authenticated in a Ldap server? Here is my httpd.conf Ldap configuration:

<Directory /var/www/html>
  AuthBasicProvider ldap
  AuthType      basic
  AuthLDAPURL   "ldap://ldapserver.com:389/o=domain.com?mail"
  AuthzLDAPAuthoritative on
  AuthName      "Please sign in with an Internet e-mail ID (IIP) which is in the Postman BlueGroup"
  AuthLDAPGroupAttribute mail
  Require       group cn=postman,ou=memberlist,ou=compgroups
</Directory>

   I think it is simple but I don't know what is happen. I use my email to authenticated it. If I use the wrong password, the follow message it appears:

[Tue Sep 22 17:07:32 2009] [warn] [client 9.6.113.47] [8449] auth_ldap authenticate: user luisecc@comp.com authentication failed; URI / [ldap_simple_bind_s() to check user credentials failed][Invalid credentials]
[Tue Sep 22 17:07:32 2009] [error] [client 9.6.113.47] user luisecc@br.ibm.com: authentication failure for "/": Password Mismatch

   But if I use the right password nether message it is showed and the authenticated it is not accept.

   So anyone can help me? Someone knows how to do this?

Best regard's

Luis


      ____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

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