You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Michelle Konzack <li...@freenet.de> on 2006/08/19 00:57:49 UTC
[users@httpd] How to disable errors and redirect allways to default.php
Hello,
I want http://domain.tld/
http://domain.tld/page1
http://domain.tld/page2
http://domain.tld/page3
http://domain.tld/...
http://domain.tld/<an_interesting_random_word>
but this pages and several 100.000' are handled by only ONE php script.
Exactly, if a user call the website e.g. "http://domain.tld/wtf" it is
automaticaly pointed to default.php (without renaming the link) and the
default.php is looking into a PostgreSQL looking for contents fiting
the virtual file name.
I know, this is possibel with apache, but HOW?
Note: If the "file" is not found, default.php will handel the error.
Thanks
Michelle Konzack
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.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
Re: [users@httpd] How to disable errors and redirect allways to default.php
Posted by Michelle Konzack <li...@freenet.de>.
Am 2006-08-21 09:43:08, schrieb Joshua Slive:
> Those will only work if php is running as a CGI.
>
> The easy (but perhaps hackish) way to solve this is
> ErrorDocument /default.php
OK
> But make sure to have your php script reset the Status header so that
> clients don't receive a 404. (I assume that is possible; I've never
> tried it myself.)
I will try it...
> Other than that, mod_rewrite could certainly do this. How complicated
> it would be would depend on your exact requirements. (For example,
> are there some real files in the filesystem that should be served if
> they are requested, or does *every* request (including for images) on
Right EVERY request.
The script know, which KeyWords are pics, ogg or whatever.
It took me some time to get it running corretly. ;-)
> this site go to /default.php.) In the simplest case:
> RewriteEngine On
> RewriteRule !^/default.php /default.php
OK.
Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.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
Re: [users@httpd] How to disable errors and redirect allways to default.php
Posted by Joshua Slive <jo...@slive.ca>.
On 8/21/06, Steve Swift <st...@gmail.com> wrote:
> If you want to map /anything to your default.php then look at
> ScriptAliasMatch or AliasMatch, depending how you setup access to
> default.php (I have no experience of how php is set up)
Those will only work if php is running as a CGI.
The easy (but perhaps hackish) way to solve this is
ErrorDocument /default.php
But make sure to have your php script reset the Status header so that
clients don't receive a 404. (I assume that is possible; I've never
tried it myself.)
Other than that, mod_rewrite could certainly do this. How complicated
it would be would depend on your exact requirements. (For example,
are there some real files in the filesystem that should be served if
they are requested, or does *every* request (including for images) on
this site go to /default.php.) In the simplest case:
RewriteEngine On
RewriteRule !^/default.php /default.php
Joshua.
Joshua.
---------------------------------------------------------------------
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] How to disable errors and redirect allways to default.php
Posted by Steve Swift <st...@gmail.com>.
The Apache directive:
AliasMatch ^/[^/]*$ /path/to/default.php
Will cause any URI which is a "/" followed by a single "word" to be handled
by the file /path/to/default.php
On 21/08/06, Michelle Konzack <li...@freenet.de> wrote:
>
> Hi back...
>
> Am 2006-08-21 14:16:10, schrieb Steve Swift:
> > If you want to map /anything to your default.php then look at
> > ScriptAliasMatch or AliasMatch, depending how you setup access to
> > default.php (I have no experience of how php is set up)
>
> I have only an index.php which has the same behaviour as an index.html
>
> So if I copy the index.php to who%20is%20steve%20swift.php and
> call it with http://server/who%20is%20steve%20swift it works.
>
> But not virtuell
>
> Greetings
> Michelle Konzack
> Systemadministrator
> Tamay Dogan Network
> Debian GNU/Linux Consultant
>
>
> --
> Linux-User #280138 with the Linux Counter, http://counter.li.org/
> ##################### Debian GNU/Linux Consultant #####################
> Michelle Konzack Apt. 917 ICQ #328449886
> 50, rue de Soultz MSM LinuxMichi
> 0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.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
>
>
--
Steve Swift
http://www.swiftys.org.uk
Re: [users@httpd] How to disable errors and redirect allways to default.php
Posted by Michelle Konzack <li...@freenet.de>.
Hi back...
Am 2006-08-21 14:16:10, schrieb Steve Swift:
> If you want to map /anything to your default.php then look at
> ScriptAliasMatch or AliasMatch, depending how you setup access to
> default.php (I have no experience of how php is set up)
I have only an index.php which has the same behaviour as an index.html
So if I copy the index.php to who%20is%20steve%20swift.php and
call it with http://server/who%20is%20steve%20swift it works.
But not virtuell
Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.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
Re: [users@httpd] How to disable errors and redirect allways to default.php
Posted by Steve Swift <st...@gmail.com>.
If you want to map /anything to your default.php then look at
ScriptAliasMatch or AliasMatch, depending how you setup access to
default.php (I have no experience of how php is set up)
On 21/08/06, Michelle Konzack <li...@freenet.de> wrote:
>
> Hello Steve,
>
> Am 2006-08-21 11:32:38, schrieb Steve Swift:
> > The environment variable "REQUEST_URI" will contain "/", "/page1",
> "/page2",
>
> Right, but...
>
> > "/page3", "/<randomword>" so you could use this variable (perhaps
> without
> > the leading "/") in your default.php to select the contents of the page.
>
> ...if the server receive the request /who%20is%20Steve%20Swift
>
> then it is to late for default.php, because the Server
> can not find the URL /who%20is%20Steve%20Swift.
>
> For some time I had seen, that I must configure apache
> to point always to default.php egal which URL.
>
> I have tried this, but the URL change all the time to /
> of default.php
>
> Do you have an example?
>
> Thanks & Greetings
> Michelle Konzack
> Systemadministrator
> Tamay Dogan Network
> Debian GNU/Linux Consultant
>
>
> --
> Linux-User #280138 with the Linux Counter, http://counter.li.org/
> ##################### Debian GNU/Linux Consultant #####################
> Michelle Konzack Apt. 917 ICQ #328449886
> 50, rue de Soultz MSM LinuxMichi
> 0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.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
>
>
--
Steve Swift
http://www.swiftys.org.uk
Re: [users@httpd] How to disable errors and redirect allways to default.php
Posted by Michelle Konzack <li...@freenet.de>.
Hello Steve,
Am 2006-08-21 11:32:38, schrieb Steve Swift:
> The environment variable "REQUEST_URI" will contain "/", "/page1", "/page2",
Right, but...
> "/page3", "/<randomword>" so you could use this variable (perhaps without
> the leading "/") in your default.php to select the contents of the page.
...if the server receive the request /who%20is%20Steve%20Swift
then it is to late for default.php, because the Server
can not find the URL /who%20is%20Steve%20Swift.
For some time I had seen, that I must configure apache
to point always to default.php egal which URL.
I have tried this, but the URL change all the time to /
of default.php
Do you have an example?
Thanks & Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.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
Re: [users@httpd] How to disable errors and redirect allways to default.php
Posted by Steve Swift <st...@gmail.com>.
The environment variable "REQUEST_URI" will contain "/", "/page1", "/page2",
"/page3", "/<randomword>" so you could use this variable (perhaps without
the leading "/") in your default.php to select the contents of the page.
On 18/08/06, Michelle Konzack <li...@freenet.de> wrote:
>
> Hello,
>
> I want http://domain.tld/
> http://domain.tld/page1
> http://domain.tld/page2
> http://domain.tld/page3
> http://domain.tld/...
> http://domain.tld/<an_interesting_random_word>
>
> but this pages and several 100.000' are handled by only ONE php script.
>
> Exactly, if a user call the website e.g. "http://domain.tld/wtf" it is
> automaticaly pointed to default.php (without renaming the link) and the
> default.php is looking into a PostgreSQL looking for contents fiting
> the virtual file name.
>
> I know, this is possibel with apache, but HOW?
>
> Note: If the "file" is not found, default.php will handel the error.
>
> Thanks
> Michelle Konzack
>
>
> --
> Linux-User #280138 with the Linux Counter, http://counter.li.org/
> ##################### Debian GNU/Linux Consultant #####################
> Michelle Konzack Apt. 917 ICQ #328449886
> 50, rue de Soultz MSM LinuxMichi
> 0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.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
>
>
--
Steve Swift
http://www.swiftys.org.uk