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 -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Mask php as html
Author
Rocker



Joined: 26 Feb 2012
Posts: 16
Location: Brazil

PostPosted: Tue 28 Feb '12 17:45    Post subject: Mask php as html Reply with quote

Hi, all

Let's assume:
I have a file.php and I want the client acces it by file.html. And, if the client try to access file.php, the server "says" 404.

Is it possible???

Thanks in advance

OBS:
I wouldn't like to rename it, and put .html as .php on Apache, 'cause it should slow down all .htmls ...


I don't know if I expressed it all fine (I'm not fluent in English Crying or Very sad ).
Back to top
Rocker



Joined: 26 Feb 2012
Posts: 16
Location: Brazil

PostPosted: Tue 28 Feb '12 18:46    Post subject: Reply with quote

I would like to make this setting in httpd.conf / htaccess ...
Back to top
James Blond
Moderator


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

PostPosted: Tue 28 Feb '12 21:36    Post subject: Reply with quote

Search for
AddHandler application/x-httpd-php .php
in your httpd.conf and replace it with

AddHandler application/x-httpd-php .php .htm .html

I guess you see the pattern Wink
Back to top
Rocker



Joined: 26 Feb 2012
Posts: 16
Location: Brazil

PostPosted: Tue 28 Feb '12 23:06    Post subject: Reply with quote

Thanks for your interest, but, what I want to do is another thing...

I don't know how to explain what I'd like to do...


I'm making a captcha.PHP. This file returns a PNG image.


I'd like to create a sort of symbolic link using htaccess. And block original file.

When client requests captcha.PNG, Apache returns captcha.PHP.
And, when client requests captcha.PHP, Apache returns 404.

In case of client requests captcha.PNG, URI keep itself as captcha.PNG.




PHP -> HTML was only an example...
Back to top
Millennium



Joined: 17 Apr 2006
Posts: 179
Location: Leiderdorp, NL, EU

PostPosted: Wed 29 Feb '12 0:13    Post subject: Reply with quote

You should start reading about mod_rewrite

That should do the trick
Back to top
Rocker



Joined: 26 Feb 2012
Posts: 16
Location: Brazil

PostPosted: Wed 29 Feb '12 0:33    Post subject: Reply with quote

Sorry, I'm a newbie on Apache...

Where can I read about mod_rewrite?
Back to top
Millennium



Joined: 17 Apr 2006
Posts: 179
Location: Leiderdorp, NL, EU

PostPosted: Wed 29 Feb '12 10:17    Post subject: Reply with quote

Well that is a kind of google question...

first hit: http://www.easymodrewrite.com/

good luck
Back to top
Rocker



Joined: 26 Feb 2012
Posts: 16
Location: Brazil

PostPosted: Wed 29 Feb '12 16:32    Post subject: Reply with quote

Thanks so much, That helped a lot.
Thanks Millennium.

Thanks for your interest, James Blond.
Back to top


Reply to topic   Topic: Mask php as html View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner