Author |
|
Rocker
Joined: 26 Feb 2012 Posts: 16 Location: Brazil
|
Posted: Tue 28 Feb '12 17:45 Post subject: Mask php as html |
|
|
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 ). |
|
Back to top |
|
Rocker
Joined: 26 Feb 2012 Posts: 16 Location: Brazil
|
Posted: Tue 28 Feb '12 18:46 Post subject: |
|
|
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
|
Posted: Tue 28 Feb '12 21:36 Post subject: |
|
|
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 |
|
Back to top |
|
Rocker
Joined: 26 Feb 2012 Posts: 16 Location: Brazil
|
Posted: Tue 28 Feb '12 23:06 Post subject: |
|
|
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
|
Posted: Wed 29 Feb '12 0:13 Post subject: |
|
|
You should start reading about mod_rewrite
That should do the trick |
|
Back to top |
|
Rocker
Joined: 26 Feb 2012 Posts: 16 Location: Brazil
|
Posted: Wed 29 Feb '12 0:33 Post subject: |
|
|
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
|
|
Back to top |
|
Rocker
Joined: 26 Feb 2012 Posts: 16 Location: Brazil
|
Posted: Wed 29 Feb '12 16:32 Post subject: |
|
|
Thanks so much, That helped a lot.
Thanks Millennium.
Thanks for your interest, James Blond. |
|
Back to top |
|