Author |
|
pop75
Joined: 21 Jul 2009 Posts: 5
|
Posted: Tue 21 Jul '09 13:38 Post subject: I'm new apache user please help ... |
|
|
hi
I'm run Apache2 2.2.9 and i want to configure my server in this way,when i have http request with *_abc10.* the server will return efd:10
how i configure this,my friend told me to use headers if so how to configure ?
thanks a lot ... |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 21 Jul '09 16:04 Post subject: |
|
|
What url do you try to type in?
http://localhost/*_abc10.* or what? |
|
Back to top |
|
pop75
Joined: 21 Jul 2009 Posts: 5
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 21 Jul '09 21:21 Post subject: |
|
|
and how do you request the *_abc10.* ? POST or GET or something? |
|
Back to top |
|
pop75
Joined: 21 Jul 2009 Posts: 5
|
Posted: Wed 22 Jul '09 9:05 Post subject: hi |
|
|
i request the file *_abc10.* with GET Method
thanks |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 22 Jul '09 9:49 Post subject: |
|
|
Sorry, but I can follow you. So you request
http://127.0.0.1/index.htm?*_abc10.*
Where is the *_abc10.* in your URL? |
|
Back to top |
|
pop75
Joined: 21 Jul 2009 Posts: 5
|
Posted: Wed 22 Jul '09 13:26 Post subject: hi |
|
|
i will try to be more clear,i have a HTML page when i press on link i download content (EX: file.jpg) and the "content-type:" open the file (with mime type configuration) i want to add header (I'm not sure) that all file content with *_abc10.* will replace to efg:10
i hope that i was more clear. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 27 Jul '09 9:30 Post subject: |
|
|
A solution I can think of is a rewrite rule that pick ups your *_abc10.* sends a to a php file which adds the wanted header and delivers than the file itself. |
|
Back to top |
|
pop75
Joined: 21 Jul 2009 Posts: 5
|
Posted: Mon 27 Jul '09 13:36 Post subject: could you |
|
|
refer to some manuals ? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 27 Jul '09 14:09 Post subject: |
|
|
The rewrite rule http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
Create a header with PHP http://www.php.net/header
Read the file http://www.php.net/file
I'm not skilled in rewrite rules. But here a short example snippet for the PHP code
Code: |
$URL = parse_url(rawurldecode($REQUEST_URI));
//.....
$strUrl = $_SERVER["HTTP_HOST"];
$path = split('/', $URL['path']);
$strFile = eregi_replace("^/", "", $URL['path']);
$strPath = "C:/apache2/htdocs/";
if (file_exists($strPath . $strFile)) {
$extension = stristr ($strFile, '.');
switch ($extension) {
case ".htm":
include($strPath . $strFile);
break;
case ".php":
include($strPath . $strFile);
break;
case ".ico":
include($strPath . $strFile);
break;
case ".gif":
include($strPath . $strFile);
break;
case ".jpg":
readfile($strPath . $strFile);
break;
case ".xls":
header("Content-type: application/vnd.ms-excel");
include($strPath . $strFile);
}
}
|
That is just an untested snipped! |
|
Back to top |
|