You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rui Hu <tc...@gmail.com> on 2011/12/20 07:46:09 UTC
questions about rewrite module
hi,
I encountered a problem while configured virtual host. My experiment
environment is Apache2+fastcgi+php-cgi.
I want to implement mass virtual hosting using rewrite rules based on
apache rewrite module. That is, for a request url like:
http://1000.xyz.com/test.php, apache will translate it to a absolute file
path like: $DOCUMENT_ROOT/1000/test.php, and then get this script to
execute.
And my conf is:
* RewriteEngine On*
* RewriteCond "%{HTTP_HOST}" "!^www.xyz.com"*
* RewriteCond "%{HTTP_HOST}" "^([^.]+)\.xyz\.com" [NC]*
* RewriteRule "(.*)" "/%1$1" [PT]*
I use inner redirection in order not to expose this detail to users.
Besides, I succeeded when I use external redirection, namely the [R] tag
instead of [PT] tag.
When I use [PT] tag, apache cannot run expectedly. I request a url :
http://1000.xyz.com/test.php, error message pops out like: The requested
URL /1000/cgi-bin/php.fcgi/1000/test.php was not found on this server.
I don't know if this error results from fastcgi, is it the inappropriate
config in fastcgi or inevitable problem by using it?
Really appreciate your help.
Vic
--
Best regards,
Rui Hu
----------------------------------------------------------------------------------------
State Key Laboratory of Networking & Switching Technology
Beijing University of Posts and Telecommunications(BUPT)
MSN: tchrbupt@gmail.com
-----------------------------------------------------------------------------------------
Re: questions about rewrite module
Posted by Rui Hu <tc...@gmail.com>.
Thanks for your response. Actually I considered mod_vhost_alias and it
worked well.
I just wanted to try some different ways, and wondered why mod_rewrite
cannot work well with fastcgi. I assume that mod_rewrite is more flexible
in url redirecting than mod_vhost_alias, and I can implement some url
redirecting of more complexity based on this module. That's why I eager to
solve this problem :-).
2011/12/26 Igor Galić <i....@brainsware.org>
>
>
> ----- Original Message -----
> > hi,
>
> Hi,
>
> Questions about how to *use* mod_rewrite -- or any module -- are
> best asked on users@
>
> > I encountered a problem while configured virtual host. My experiment
> > environment is Apache2+fastcgi+php-cgi.
> >
> >
> > I want to implement mass virtual hosting using rewrite rules based on
> > apache rewrite module. That is, for a request url like:
> > http://1000.xyz.com/test.php , apache will translate it to a
> > absolute file path like: $DOCUMENT_ROOT/1000/test.php, and then get
> > this script to execute.
>
> Have you considered using something like mod_vhost_alias?
>
> http://httpd.apache.org/docs/current/mod/mod_vhost_alias.html
> http://wiki.apache.org/httpd/VirtualHostAlias
>
> > And my conf is:
> >
> > RewriteEngine On
> > RewriteCond "%{HTTP_HOST}" "!^ www.xyz.com "
> > RewriteCond "%{HTTP_HOST}" "^([^.]+)\.xyz\.com" [NC]
> > RewriteRule "(.*)" "/%1$1" [PT]
> >
> > I use inner redirection in order not to expose this detail to users.
> > Besides, I succeeded when I use external redirection, namely the [R]
> > tag instead of [PT] tag.
> > When I use [PT] tag, apache cannot run expectedly. I request a url :
> > http://1000.xyz.com/test.php , error message pops out like: The
> > requested URL /1000/cgi-bin/php.fcgi/1000/test.php was not found on
> > this server.
> >
> >
> > I don't know if this error results from fastcgi, is it the
> > inappropriate config in fastcgi or inevitable problem by using it?
> >
> >
> > Really appreciate your help.
> >
> >
> > Vic
> >
> > --
> > Best regards,
> >
> > Rui Hu
> >
> ----------------------------------------------------------------------------------------
> > State Key Laboratory of Networking & Switching Technology
> > Beijing University of Posts and Telecommunications(BUPT)
> > MSN: tchrbupt@gmail.com
> >
> -----------------------------------------------------------------------------------------
> >
> >
> >
>
> --
> Igor Galić
>
> Tel: +43 (0) 664 886 22 883
> Mail: i.galic@brainsware.org
> URL: http://brainsware.org/
> GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE
>
--
Best regards,
Rui Hu
----------------------------------------------------------------------------------------
State Key Laboratory of Networking & Switching Technology
Beijing University of Posts and Telecommunications(BUPT)
MSN: tchrbupt@gmail.com
-----------------------------------------------------------------------------------------
Re: questions about rewrite module
Posted by Igor Galić <i....@brainsware.org>.
----- Original Message -----
> hi,
Hi,
Questions about how to *use* mod_rewrite -- or any module -- are
best asked on users@
> I encountered a problem while configured virtual host. My experiment
> environment is Apache2+fastcgi+php-cgi.
>
>
> I want to implement mass virtual hosting using rewrite rules based on
> apache rewrite module. That is, for a request url like:
> http://1000.xyz.com/test.php , apache will translate it to a
> absolute file path like: $DOCUMENT_ROOT/1000/test.php, and then get
> this script to execute.
Have you considered using something like mod_vhost_alias?
http://httpd.apache.org/docs/current/mod/mod_vhost_alias.html
http://wiki.apache.org/httpd/VirtualHostAlias
> And my conf is:
>
> RewriteEngine On
> RewriteCond "%{HTTP_HOST}" "!^ www.xyz.com "
> RewriteCond "%{HTTP_HOST}" "^([^.]+)\.xyz\.com" [NC]
> RewriteRule "(.*)" "/%1$1" [PT]
>
> I use inner redirection in order not to expose this detail to users.
> Besides, I succeeded when I use external redirection, namely the [R]
> tag instead of [PT] tag.
> When I use [PT] tag, apache cannot run expectedly. I request a url :
> http://1000.xyz.com/test.php , error message pops out like: The
> requested URL /1000/cgi-bin/php.fcgi/1000/test.php was not found on
> this server.
>
>
> I don't know if this error results from fastcgi, is it the
> inappropriate config in fastcgi or inevitable problem by using it?
>
>
> Really appreciate your help.
>
>
> Vic
>
> --
> Best regards,
>
> Rui Hu
> ----------------------------------------------------------------------------------------
> State Key Laboratory of Networking & Switching Technology
> Beijing University of Posts and Telecommunications(BUPT)
> MSN: tchrbupt@gmail.com
> -----------------------------------------------------------------------------------------
>
>
>
--
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE