Posts: 6
Threads: 2
Joined: Apr 2011
Is it possible to integrate the script in a html page? I cannot change my existing file extensions from html to php otherwise their rankings of the search engines will fall down to zero.
Posts: 2,894
Threads: 59
Joined: Jun 2010
Hi,
I'm afraid it needs to be a PHP file.
There are a couple of options that you may not have considered:
1. Changing the file extension to PHP and then using .htaccess to re-write the extension to HTML.
2. Changing the file extension to PHP and then using .htaccess to do a permanent redirect (301).
Have
you completed
the interview?
Posts: 6
Threads: 2
Joined: Apr 2011
Thanks for the answer. Can you tell me what exactly I must write in .htaccess for either rewrite the extension and the redirect? And what consequences both solutions will this have on the ranking?
I already tried the code
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
in .htaccess but it does not work. The guy who recommends this argues that with this code the server executes php code in html pages.
Posts: 2,894
Threads: 59
Joined: Jun 2010
A permanent redirect would look like this:
Code:
Redirect 301 /somepage.html http://www.example.com/somepage.php
Search engines will transfer the page ranking across. Just make sure to keep it in place for a while.
I haven't ever had to rewrite a file extension but found this:
Code:
AddHandler application/x-httpd-php .php .html .htm
Search engines won't even know anything is different.
Have
you completed
the interview?
Posts: 99
Threads: 30
Joined: May 2011
(10-Apr-2011, 02:09 PM)Huldrich Wrote: Is it possible to integrate the script in a html page? I cannot change my existing file extensions from html to php otherwise their rankings of the search engines will fall down to zero.
Hi Huldrich.
try adding this line to your .htaccess file in the directory where the HTML pages are in which you want to include a PHP code:
Quote:AddType application/x-httpd-php .html
Next, all you need to do is put this piece of PHP code you want to include into a PHP file (open your favorite text editor and write your code, then save it as .php file.)
Next, include your PHP code at any place you want to appear it in your HTML file by calling it like this;
Code:
<?php require("pathtofile/myphpfile.php"); ?>
Note that you need to replace this part "
pathtofile/myphpfile.php" with the actual path and name of your website!
Hope I make sense
(it works fine with me here and I have dozens of HTML pages with several of these includes each.
Best of luck
Posts: 13
Threads: 5
Joined: Sep 2011
Hi all,
My pages are pure html with some javascript. I implemented what Norbs said and it works well.
Thank Steven and Norbs
Posts: 14
Threads: 0
Joined: Sep 2011
hy all
i have a html page and i try put in but i get this error
Warning: require() [function.require]: URL file-access is disabled in the server configuration in /hermes/bosweb/web277/b2772/ipg.mysite/index.html on line 56
Warning: require(
http://www.mysite.com/most.php) [function.require]: failed to open stream: no suitable wrapper could be found in /hermes/bosweb/web277/b2772/ipg.mysitecom/index.html on line 56
Fatal error: require() [function.require]: Failed opening required 'http://www.mysite.com/most.php' (include_path='.:/usr/local/lib/php-5.2.17/lib/php') in /hermes/bosweb/web277/b2772/ipg.mysitecom/index.html on line 56
Posts: 38
Threads: 3
Joined: Jul 2011
(22-Sep-2011, 05:21 PM)jason4886 Wrote: hy all
i have a html page and i try put in but i get this error
Warning: require() [function.require]: URL file-access is disabled in the server configuration in /hermes/bosweb/web277/b2772/ipg.mysite/index.html on line 56
Warning: require(http://www.mysite.com/most.php) [function.require]: failed to open stream: no suitable wrapper could be found in /hermes/bosweb/web277/b2772/ipg.mysitecom/index.html on line 56
Fatal error: require() [function.require]: Failed opening required 'http://www.mysite.com/most.php' (include_path='.:/usr/local/lib/php-5.2.17/lib/php') in /hermes/bosweb/web277/b2772/ipg.mysitecom/index.html on line 56
Hello,
As far as i'm aware you can't use 'http://www.mysite.com/' or any full domain in required, required_once or include it needs to be path/to/folder/file.php - as far as i'm aware..
If you only plan on including the PHP on one page, it is better to setup this way:
Code:
<Files yourpage.html>
AddType application/x-httpd-php .html
</Files>
OR
<Files yourpage.html>
AddType application/x-httpd-php .htm
</Files>
for .html:
Code:
AddType application/x-httpd-php .html
for .htm
Code:
AddType application/x-httpd-php .htm
anything in your .html files that starts with <? will now be executed as PHP, so if it's in your file for some other reason (an XML tag for example) you will need to echo these lines to prevent errors. For example:
Code:
<?php echo '<?xml version="1.0" encoding="IUTF-8"?>'; ?>
Posts: 14
Threads: 0
Joined: Sep 2011
thank you jordann for your help
its work now evrything comment name email.thank you everybody.and the free script.
But now i have a little problem the comment what i sent and show above is grey so is very hard to read how can i change the letter color to black?
thank you again
Posts: 38
Threads: 3
Joined: Jul 2011
(23-Sep-2011, 05:38 PM)jason4886 Wrote: thank you jordann for your help
its work now evrything comment name email.thank you everybody.and the free script.
But now i have a little problem the comment what i sent and show above is grey so is very hard to read how can i change the letter color to black?
thank you again
could you provide me with url or screenshot what letter you mean? but it can be done with css (if i think i know what you mean by letter)
http://www.w3schools.com/cssref/pr_text_color.asp
http://www.december.com/html/spec/color.html