You are here:  » copy index.php output to index.html

Support Forum



copy index.php output to index.html

Submitted by biglion on Tue, 2009-12-01 18:41 in

Is there a simple command to add to the fetch.sh script that will copy the output of the index.php file to a static index.html file?

Thanks for your help.

Submitted by support on Wed, 2009-12-02 09:37

A search engine should only ever request an index.html directly if it is following a specific link to that file; so the main thing to make sure is that you do not have any links - perhaps on other sites, that point to index.html. Second, you web server should be configured to be serving your home page via index.php for a request directly to the top level of your website; e.g:

http://www.example.com/

What I would recommend, if you are seeing requests to index.html in your access logs; is to add a rule to your .htaccess to return a 301 (Moved Permanently), for example:

RewriteRule ^index.html$ http://www.example.com/ [L,R=301]

Hope this helps!

Cheers,
David.

Submitted by biglion on Wed, 2009-12-02 15:50

When I add the redirect and delete my existing index.html file, the server does not respond (infinite loop perhaps?). Without the redirect and deleting my existing index.html, the server responds with index.php

For whatever reason, in Google webmaster tools, Google claims www.site.com/index.html does not exist even though all links simply point www.site.com.

I thought if I could copy the output of index.php into the index.html file on a daily basis when the fetch.sh script runs via cron, the server will respond with index.html and Google won't have any problems.

Submitted by support on Wed, 2009-12-02 18:08

Hi,

Sure - have a go with the following in your fetch script, and assuming that it is running in a folder immediately above the top level directory of your website:

wget -O "../index.html" "http://www.example.com/index.php"

Hope this helps!

Cheers,
David.