PHP Site Map (and Google Sitemap) Download



Description:

This PHP script is perfect for all those static HTML websites out there. It allows you to quickly and easily display an automatic site map with links to all of all the files on your website. If you add a new HTML file to your website, it will automatically appear in the site map.

How it works:

The script searches your website for a list of files and displays them in a nice looking tree hierarchy. The tree can easily be styled with css (or you can use the default style that comes with it). The script will only display certain file types (eg: .php, .htm, .html) which can be changed in the configuration. You can also easily “hide” files that you do not want to display in the site map.
Check out the automatic php sitemap demo to see it in action.

Google XML Sitemap:

Google allows you to send it an XML representation of your website. Submitting your XML site map is done through Google Webmaster Tools. An XML site map can help search engines find all your website pages, without having to “crawl” through links. An XML site map also shows when a page last changed, which help search engines keep up to date with your website content.
You can view a sample XML site map as generated by this script, or read more about Google Sitemaps.

Advanced Users:

If you have a dynamic side to your website (eg: database driven shopping cart) it is possible to modify this script to ‘also’ display a complete list of products from your database. If you know PHP well then you should have no problems figuring this out. If you’re nice I might even be able to help you with some coding :)

Installation Instruction:

A help file with instructions comes inside the purchased ZIP file, you can also view the instructions and more information by clicking here. The files from the live demo also come in the purchased file.

Feel free to ask me any questions.



My other easy to use PHP Scripts:
PHP Client Database Display ebay items on your own website Javascript Website Comments PHP Site Map (and Google Sitemap) Javascript user counter Javascript Star Rating System Envato Statistics Dashboard Simple PHP Newsletter System



(generated from my new Online User Counter script)

  1. WBATFT:

    Will this work with php 5?

  2. WBATFT:

    Yes, this script works fine on PHP4 and PHP5 .

    Thanks.

  3. heppner:

    Hi,

    Good job. I’d like to hide directory (with subdirectories), how to do it?

    Regards,

    Paul

  4. heppner:

    Thanks for purchasing, search for this:

    $sitemap_ignore_files = array(

    on about line 136. if the directory you wish to hide is called “my_directory” then add this just underneath:

    "/.*my_directory.*/",
    

    this will hide anything that contains “my_directory” from displaying in the site map.

    good luck!

    dtbaker

  5. heppner:

    I have “php” directory, when I put

    ”/.php./”,

    it also hides all my files with the php extension

  6. heppner:

    It is also impossible to hide the directory if you have file with name which contains the directory name string. For example: when “tv” is your directory you want to hide then you also hide every file with “tv” string: productiontv.html, studiotv.php, protvshop.php and so on… I think the different method to hide directories is needed.

  7. heppner:

    Hi heppner,

    Thank you for the feedback, I will include a separate directory hiding method in the next release.

  8. Svipic:

    I have Dynamic site in php.

    No html files in it. Can it be possible to index all my pages with this sitemap tool or it is for static html sites ?

  9. Svipic:

    Hi Svipic,

    If you know PHP then yes you will be able to modify this script to read your “page list” out of a database. This really depends on how you have everything set up, it may be easier just to create your own one from scratch.

  10. pinkfoot:

    Hello,

    i get and error ‘Invalid argument supplied for foreach()’ which is

    foreach(glob($directory."*")

    i have all my .php files in my public html root along with sitemap.php

    Any help will be appreciated.

    Thx

  11. Basboy:

    Is there a possibility to ignore all maps an then select the maps I want to include… I got a bunch of maps in at my server but 9 out of 10 doesn’t need to come on my sitemap :)

  12. Basboy:

    And I’ve got a Wordpress blog in a subfolder, how to get those pages/sitemap :O ?

  13. cascavalito:

    It will work on a flash site?

  14. dweb:

    Not working with directories !

  15. QuailAdvertising:

    will it work if I have a flash/xml site

  16. maryalenn:

    Really like the code and trying to get it to work on my site, but I’m getting an error:

    Invalid argument supplied for foreach() in [filepath]/sitemap.php on line 223

    Line 223 references the following portion of code:

    foreach(glob($directory."*") as $f){

    Seems to have a problem with the files that are in the root directory. All other directories are displaying properly.

    Any help is appreciated!

  17. maryalenn:

    shoot me an email with a link to your website with the error and I may be able to help.

  18. vidal:

    HI there,

    I would like to index all my pages from cargeni.com but I get errors (http://www.cargeni.com/sitemap.php) and

    it looks like it only sitemaps local files and directores, but Dynamic urls, I have over 5000 links… How about the urls to the Car Makes http://www.cargeni.com/browse-makes/acura/ all this links are on http://www.cargeni.com but you script does not index this? How comes

    Thanks

  19. vidal:

    This script will only display local files, not dynamic links.

  20. ybouhlel:

    Hi

    I have an error! please help me

    Parse error: syntax error, unexpected $end in D:\xampp\htdocs\sitemap-demo\sitemap.php on line 355

    Thanks

  21. ybouhlel:

    Please try to enable php short open tags in the php configuration

  22. ybouhlel:

    thank you very much for your reply dtbaker the problem was solved! I’m sorry I have clicked the wrong reply message ‘report’ I’ sorry agan.

  23. ybouhlel:

    sorry for any inconvenience

  24. and_usa:

    Hi

    I get the same error

    Parse error: syntax error, unexpected $end in D:\xampp\htdocs\sitemap-demo\sitemap.php on line 355

    And aparently there were some usefull advise in the reply from dt baker. :-)

    Well somethimes I also use inappropriate language if things don’t work.

    Hope you can help.

  25. skweeze:

    I have a very small site (10-15 pages) and I have all my pages sitting on the root and my .htaccess file is rewrting the URLs to look like they are sitting within folders etc. This sitemap generator is not going to work with this or am i wrong?? I have tried it a it just generates the original filenames/extentions and locations of the files and not the ones i’ve rewritten. Is there any way to combat this?

  26. motherswhowork:

    Hi there,

    I get a header error message saying the header is invalid when I upload this plugin.

    I have edited the header slot, but still get the same error message. Do you know why this is?

  27. motherswhowork:

    No, Since you are having this issue with my other scrips as well then it will be your hosting account. Please contact your hosting provider.

  28. motherswhowork:

    Hi there,

    I get a header error message saying the header is invalid when I upload this plugin.

    I have edited the header slot, but still get the same error message. Do you know why this is?

  29. motherswhowork:

    No, Since you are having this issue with my other scrips as well then it will be your hosting account. Please contact your hosting provider.

  30. raindi:

    Hi,

    Parse error: syntax error, unexpected $end in C:\XAMPP\xampp\htdocs\php-site-map-and-google-sitemap-source\sitemap-demo\sitemap.php on line 355

    Please Help, Thank you.

  31. raindi:

    Try enabling php short open tags

  32. maista: Presuming that I have a following structure:
    .*
    [folder1]
     -test.html
    [folder2]
    test.html
    test2.html
    
    How can I ignore the test.html file but only the one inside root ? (If I add it to ignore array then both files disappear)

    Thanks in advance

  33. maista:

    you could try an ignore something like this:

    ^/test\.html

  34. maista:
    #^/test\.html#
  35. jamiemscott:

    Hi, I’m getting the same Invalid argument supplied for foreach() error as the user Pinkfoot.

    it’s throwing up the error for this line of code…

    // the below is very simple, it just finds all the files and folders within a // specified directory. if($directory){ $directory = rtrim($directory,'/') . '/'; } foreach(glob($directory."*") as $f){ if(is_dir($f)){

    Any ideas?

    Other than that, awesome script!

  36. jamiemscott:

    Ok problem fixed, if anyone is having this problem look at what folders you’ve forgotten to exclude. Each one of my errors was down to a folder like cgi-bin not being on the exclude list.

    Excelent script btw, worth buying for your tool box all day long!

  37. reisberg:

    Hi, I apologize if this question has been answered, but does this work for Wordpress?

    Thank you.

  38. relvinnian:

    This is an flawed product for two reasons:

    1. pregmatch directory hiding means that you cannot easily exclude directories that are named something that might cause exclusion of other relevant files. For example if you keep your apache error pages in an “error” directory, this will hide the directory fine. However, if you have another file (unrelated) named error.php, it will hide this too. This is unacceptable.

    2. No GUI . While using regex exclusions is fairly easy to set up, it’s inconvenient, and it going to be confusing for noobs.

    I think with a GUI and a more sophisticated engine, CodeCanyon would have priced this at $10 and you’d probably have just as many sales. I know I would buy it.

  39. relvinnian:

    Thanks for your feedback.

    You may try a regex such as #error/# to hide the folder named “error” and its contents, while leaving “error.php” displaying in the results.

  40. claudeabandonato:

    Hi dtbaker,

    Great script, very nice.

    But i have a few problem with due probably with my poor knowlegde.

    My first problem is if i have a fo;der with index.php. it’s show on the sitemap index.php instead of the name of my folder.

    Second i have problem to hide folder like ’’ lib ’’.

    If you have a time, i will need your help please.

  41. claudeabandonato:

    Hello,

    You can submit your support request at http://support.dtbaker.com.au along with your FTP details so we can implement this for you.

    Most likely index.php does not have a page title that the script can fine.

    Thanks, dtbaker

  42. claudeabandonato:

    Hi dtbaker,

    I found the way to hide folder, but still have problem with folder with index_php, who show the same name for the folder.

    Still need your help on this please

  43. claudeabandonato:

    Please submit a support ticket to http://support.dtbaker.com.au with your FTP details and an explanation of what you are trying to achieve. We do not check these item discussion comments often.

    Thanks, dtbaker

  44. scarabsweepers:

    Brilliant script , would love to see a choice of templates the current layout is a little bit long if you have many folders/links.

  45. scarabsweepers:

    Glad you like it

  46. Tartoob:

    how can I make it create sitemap.xml constantly ?

  47. Tartoob:

    as you can see http://www.arb.bb/sitemap.php?xml is shows me only main php files
    How can I make it like this one http://www.arb.bb/sitemap.xml

  48. stephenakovach:

    lousy script. keeps throwing database errors. doesn’t even make sense since there is no database connection, per se. tried it on a smaller site and it worked, but not on complex sites. keep it in mind when you consider purchasing this script.

  49. stephenakovach:

    yes very strange re the database errors. this doesn’t use databases. please send in a support ticket if you need assistance: http://support.dtbaker.com.au/support-ticket.html

  50. salvabiedma:

    Hello DTBaker,

    Im having problem with the special characters such as ”-” “ón” “ñ” ... i would need to fix it. How can i do it?

    http://totalisimo.com/nuevaweb/sitemap.php

    Thanks

  51. kmwsoftech:

    My site is dynamic is it any possibility that i get the sitemap.xml for my complete site urls?

  52. teradch:

    Hi, Can you let me know how to hide a folder within another folder?

    Example: www.mysite.com/my-products/electical/

    Please let me know how to hide /electical/ folder inside /my-products/ folder?

  53. mfdezine:

    I have a question. I have a large amount of folders on my server that I do not want included in the sitemap. Does this script read the robots file to see which folders not to include or can this be easily done manually?

    Thanks

  54. rivera2419:

    I’m using sitemap.php inside iFrame. How can I get the browser to break out of iFrame when a user clicks on one of my website’s page links?

    Thanks!

  55. groundfalling:

    OK i used this sitemap for one of my main site which also have many addon sites in it. so when i accessed the sitemap.php it has generated a humongous list of every php and html file including the plugin ones and everything else. Your instruction of hiding files that contain a particular word cannot work for me as i have so many files. so my question is how do i confine this list to only particular links from my main domain should i add these links manually to the sitemap.php file? Would appreciate your help thanks

  56. anklam:

    WTF!

    Indexed local files, not the links on my page.

    Useless for me to want my money back!

  57. anklam:

    Wrong: The script searches your website for a list of files and displays them in a nice looking tree hierarchy.

    Who the hell still so today established a website? Such scripts but today is index.php?site=thepage standard, since I do not need scripts 0815 when it shows only the index.php :-(. Displays only the data of the web space there are free on the net. https://www.google.de/?q=sitemap+mit+php+erstellen

  58. smga:

    Good Day! Link http://tf.dtbaker.com.au/automatic-sitemap/index.html doesn’t work (((

  59. realbookmarks:

    Hi,

    It looks as if you are no longer supporting this useful little bit of code, but I’ll post my query here anyway, just in case :)

    My hosting has PHP 5.4 installed

    Your code is being used only to generate a site map for use by the visitors to a small charity website, and does the job just fine, so I see no reason not to continue running it.

    However, it continually generates an error log, which contains the following warning/s:

    [18-Nov-2013 12:31:36 Europe/London] PHP Warning: preg_match(): Compilation failed: nothing to repeat at offset 0 in /home/website/public_html/xxx/sitemap.php on line 759

    [18-Nov-2013 12:31:36 Europe/London] PHP Warning: preg_match(): Compilation failed: nothing to repeat at offset 0 in /home/website/public_html/xxx/sitemap.php on line 800

    Is there any way to stop this error from being continually generated please?