how to use php code in html page?

Status
Not open for further replies.

saiman

New Member
Messages
10
Reaction score
0
Points
0
Good day for all,i have one question.I have html pages with php-code,but php don't execute.How I can correct it?
 

Zubair

Community Leader
Community Support
Messages
8,766
Reaction score
305
Points
83
make them to php by changing the extension to .php
 
Last edited:

saiman

New Member
Messages
10
Reaction score
0
Points
0
make them to php by changing the extension to .php
It is good thought,but i have many pages and in them there are references to other pages:sad:maybe can be more simple way?
I read that it is possible to do so, having written in .htaccess

RewriteEngine on
RewriteRule ^(.*)\.html $1\.php
but isn't working
 
Last edited:

Zubair

Community Leader
Community Support
Messages
8,766
Reaction score
305
Points
83
It is good thought,but i have many pages and in them there are references to other pages:sad:maybe can be more simple way?

Open your .htaccess (hidden file located in public_html folder) file and add this line in it.. :)
Code:
AddType application/x-httpd-php .html .htm
 
Last edited:

Gouri

Community Paragon
Community Support
Messages
4,565
Reaction score
245
Points
63
It is good thought,but i have many pages and in them there are references to other pages:sad:maybe can be more simple way?

It is tedious but you have to do.

You can download them to your computer and then rename all of their extension at a time using dos command then upload. But It is not recommended because just changing the extensions won't guaranty load all the things because we don't know what format code is written in those files. So manual checking is required for each file.
 

saiman

New Member
Messages
10
Reaction score
0
Points
0
Open your .htaccess (hidden file located in public_html folder) file and add this line in it.. :)
Code:
AddType application/x-httpd-php .html .htm

i write this line in file,and...nothing

i make folder gryppa.x10hosting.com/phptest/ with two files: test.html and test.php
Their text..
<?php
echo "Test";
?>

test.php - work
test.html - Doesn't work
:dunno:What to do? (
 

Zubair

Community Leader
Community Support
Messages
8,766
Reaction score
305
Points
83
Move these files to public_html folder...

or copy .htaccess file in phptest folder :)
 
Last edited:

saiman

New Member
Messages
10
Reaction score
0
Points
0
Move these files to public_html folder...

or copy .htaccess file in phptest folder :)

path to phptest public_html/phptest ....

i copy .htaccess iin folder "phptest", but when i write path in address line,i see this
 

Attachments

  • screen.GIF
    screen.GIF
    29.8 KB · Views: 42

Zubair

Community Leader
Community Support
Messages
8,766
Reaction score
305
Points
83
Let me try this on my account...

I will post back after done.
Edit:
I have tested it on 2 different servers but it is not working.

you have to change extension of your files to .php to make this work :)
 
Last edited:
Status
Not open for further replies.
Top