htaccess serving different domain with different front controllers
htaccess serving different domain with different front controllers
am 24.09.2009 08:43:54 von james cauwelier
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 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: htaccess serving different domain with different
am 24.09.2009 13:06:40 von Krist van Besien
On Thu, Sep 24, 2009 at 8:43 AM, james cauwelier
wrote:
> Here is my .htaccess (I deleted unimportant parts from my colleague),
> I suspect the line with [S=3D1] is to blame:
Yes, it is. [S=3D1] is only valid for a RewriteRule, not a RewriteCond.
> # redirect only when file not found
> RewriteCond %{REQUEST_FILENAME} !-f
>
> RewriteCond %{HTTP_HOST} =A0^sioen.* [S=3D1]
>
> RewriteRule ^(.*)$ /web/index.php?command=3D$1 [QSA,L]
> RewriteRule ^(.*)$ /web/sioen.php?command=3D$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#I nternalRuleset
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=3D$1 [QSA,L]
RewriteRule ^(.*)$ /web/sioen.php?command=3D$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=3D$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^sioen.*
RewriteRule ^(.*)$ /web/sioen.php?command=3D$1 [QSA,L]
HTH,
Krist
(Tussen haakjes, is "sioen" wat ik denk dat het is :-)
--=20
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 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
Apache 2.2 + Ldap
am 24.09.2009 14:55:11 von Luis Clemente
Hi all,
Someone knows how I can setting the apache 2.2. server to a=
uthenticated in a Ldap server? Here is my httpd.conf Ldap configuration:=0A=
=0A=0A AuthBasicProvider ldap=0A AuthType b=
asic=0A AuthLDAPURL "ldap://ldapserver.com:389/o=3Ddomain.com?mail"=0A =
AuthzLDAPAuthoritative on=0A AuthName "Please sign in with an Interne=
t e-mail ID (IIP) which is in the Postman BlueGroup"=0A AuthLDAPGroupAttri=
bute mail=0A Require group cn=3Dpostman,ou=3Dmemberlist,ou=3Dcompgro=
ups=0A
I think it is simple but I don't know what is ha=
ppen. 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 authenticat=
ion failed; URI / [ldap_simple_bind_s() to check user credentials failed][I=
nvalid credentials]=0A[Tue Sep 22 17:07:32 2009] [error] [client 9.6.113.47=
] user luisecc@br.ibm.com: authentication failure for "/": Password Mismatc=
h
But if I use the right password nether message it is showed and t=
he authenticated it is not accept.
So anyone can help me? Someone k=
nows how to do this?
Best regard's
Luis
=0A ___________=
____________________________________________________________ _____________=
=0AVeja quais s=E3o os assuntos do momento no Yahoo! +Buscados=0Ahttp://br.=
maisbuscados.yahoo.com
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Apache 2.2 + Ldap
am 24.09.2009 15:20:07 von Tom Evans
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:
>
>
> 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
>
>
> 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 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: htaccess serving different domain with different front controllers
am 24.09.2009 18:53:31 von james cauwelier
--Apple-Mail-5-626104692
Content-Type: text/plain;
charset=US-ASCII;
format=flowed;
delsp=yes
Content-Transfer-Encoding: 7bit
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
--Apple-Mail-5-626104692
Content-Type: text/html;
charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
-webkit-line-break: after-white-space; ">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:
class=3D"Apple-interchange-newline">
class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =
rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: =
normal; font-variant: normal; font-weight: normal; letter-spacing: =
normal; line-height: normal; orphans: 2; text-align: auto; text-indent: =
0px; text-transform: none; white-space: normal; widows: 2; word-spacing: =
0px; -webkit-border-horizontal-spacing: 0px; =
-webkit-border-vertical-spacing: 0px; =
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
auto; -webkit-text-stroke-width: 0px; ">
href=3D"mailto:krist@vanbesien.org">vanbesien.org
<=
/div>
=
--Apple-Mail-5-626104692--
Re: htaccess serving different domain with different front controllers
am 24.09.2009 21:08:48 von Nick
Hi James,
> - web/index.php for the main website
> - web/sioen.php for a copy of the website with different looks
An alternative: ( I'd use perl to do this )
index.cgi (or index.pl)
$lowerCase = lc($ENV{'HTTP_HOST'});
if ($lowerCase =~ /sioen/) {
$Page = "sioen";
} else {
$Page = "index";
}
then do what you need to do with /web/$Page.php?command=$1
Nick. . .
( Ich kann das klavier spielen ) :)
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
. . . . . . . .
Please visit my Web Hosting/Design Business at: http://MyHost.org
-=[ The prices are great - as is the service ]=-
. . . . . . . .
...---... (Stamp Out Spam and Save Our Servers) http://sosNow.ws
. . . . . . . .
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Re: htaccess serving different domain with
am 25.09.2009 08:07:47 von james cauwelier
Thanks Nick,
But this is a solution I already thought off, except in PHP. Anyway,
I think it is cleaner to put this kind of things in .htaccess,
especially when a client needs about 6 different domain for one
particular front controller.
But thanks for the input.
James
2009/9/24 :
> =A0Hi James,
> =A0 > - web/index.php for the main website
> =A0 > - web/sioen.php for a copy of the website with different looks
>
> =A0 =A0 An alternative: =A0( I'd use perl to do this )
>
> =A0 =A0 index.cgi (or index.pl)
> =A0 =A0 =A0 =A0$lowerCase =3D lc($ENV{'HTTP_HOST'});
> =A0 =A0 =A0 =A0 if ($lowerCase =3D~ /sioen/) {
> =A0 =A0 =A0 =A0 =A0$Page =3D "sioen";
> =A0 =A0 =A0 =A0 } else {
> =A0 =A0 =A0 =A0 =A0$Page =3D "index";
> =A0 =A0 =A0 =A0 }
>
> =A0 then do what you need to do with /web/$Page.php?command=3D$1
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Nick. . .
> =A0 ( Ich kann das klavier spielen ) :)
>
> =A0 _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0. =A0. =A0. =A0. =A0. =A0.=
=A0. =A0.
> =A0 Please visit my Web Hosting/Design Business at: http://MyHost.org
> =A0 =A0 =A0 =A0 =A0-=3D[ =A0The prices are great - as is the service =A0]=
=3D-
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0. =A0. =A0. =A0. =A0. =A0.=
=A0. =A0.
> =A0 ...---... (Stamp Out Spam and Save Our Servers) =A0http://sosNow.ws
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0. =A0. =A0. =A0. =A0. =A0.=
=A0. =A0.
> =A0 _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project=
..
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> =A0" =A0 from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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