My webpage is PHP.
I have a HTML landing page in my subdomain and must stay HTML.
In my subdomain i have a .PHP page and give me room prices per day.
I have include this code in my HTML page but doesn't work.
€ <?php getRoomRates('standard'); ?>
In my official website it works perfect.
I know that .php codes doesn't work in HTML pages.
I have try some solutions from here as .htaccess file but doesn't work.
I am not professional but i try ....
Asked
Active
Viewed 42 times
1

Spiros Laskaris
- 11
- 2
-
in order to let the server knows that there are some php content in the page it has to be with a php extension, it is default behaviour, but you can also ask the server to send html pages to php : https://stackoverflow.com/questions/6295141/server-not-parsing-html-as-php – Tuckbros Feb 03 '21 at 18:12
-
You can use ajax for php content – Pushpendra Singh Feb 03 '21 at 18:14
1 Answers
0
You have to save the file as a .php file and redirect it using RewriteRule. Add this code to your .htaccess file:
# if you don't already have it:
RewriteEngine On
# redirect html to php
RewriteRule ^your/public/html/file.html$ path/to/your/php/file.php

Dharman
- 30,962
- 25
- 85
- 135

blaumeise20
- 2,148
- 8
- 26
-
Thank you for your answer. When i tried save the file as .php all page graphics have been dismantled. – Spiros Laskaris Feb 04 '21 at 09:57
-
If I understood it correctly, my answer doesn't work. The paths in the .php file must be relative to the public .html file, because the browser doesn't know where the .php file is. – blaumeise20 Feb 04 '21 at 10:13
-
Maybe i don't understood what i exactly to make. My file is answertest.html. I saved as answertest.php. It is in my subdomain https://www.my.subdomain.gr/answertest.php. Have i to include both pages in ftp html and php? I dont understood how i will make the RewriteRule ^your/public/html/file.html$ path/to/your/php/file.php. The paths in the .php file it is relative to the public .html file – Spiros Laskaris Feb 04 '21 at 11:56
-
Add this to your .htaccess file: `RewriteRule ^answertest.html$ answertest.php` And no, you don't have to save a file with a .html extension on the server. – blaumeise20 Feb 04 '21 at 16:36