logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: I'm new apache user please help ...
Author
pop75



Joined: 21 Jul 2009
Posts: 5

PostPosted: Tue 21 Jul '09 13:38    Post subject: I'm new apache user please help ... Reply with quote

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

PostPosted: Tue 21 Jul '09 16:04    Post subject: Reply with quote

What url do you try to type in?

http://localhost/*_abc10.* or what?
Back to top
pop75



Joined: 21 Jul 2009
Posts: 5

PostPosted: Tue 21 Jul '09 17:05    Post subject: Reply with quote

Hi

i type http://localhost/index.htm
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 21 Jul '09 21:21    Post subject: Reply with quote

and how do you request the *_abc10.* ? POST or GET or something?
Back to top
pop75



Joined: 21 Jul 2009
Posts: 5

PostPosted: Wed 22 Jul '09 9:05    Post subject: hi Reply with quote

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

PostPosted: Wed 22 Jul '09 9:49    Post subject: Reply with quote

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

PostPosted: Wed 22 Jul '09 13:26    Post subject: hi Reply with quote

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

PostPosted: Mon 27 Jul '09 9:30    Post subject: Reply with quote

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

PostPosted: Mon 27 Jul '09 13:36    Post subject: could you Reply with quote

refer to some manuals ?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 27 Jul '09 14:09    Post subject: Reply with quote

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


Reply to topic   Topic: I'm new apache user please help ... View previous topic :: View next topic
Post new topic   Forum Index -> Apache