SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,118
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)

    XML -> PHP generates Sitemap

    Hi,

    I have a php page that generates an XML sitemap with xml headers and everything.
    My question is -
    Is there a way I can visit say.. "http://www.fake.com/sitemap.xml"
    And have the php script exectute.

    It's all running on an Apache server. - Wondering if I can do this via .htaccess or something. Perhaps this is the wrong forum...

    Thanks,

  2. #2
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a way, using Apache's rewrite engine. Ask this question in the Apache Configuration forum, and you'll probably get a lot of good advice.

    EDIT: Read the other threads dealing with ForceType, FilesMatch, mod-rewrite, etc. first. Your question may have already been answered.
    Last edited by World Wide Weird; Apr 19, 2007 at 18:45. Reason: Added paragraph.

  3. #3
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,118
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Found it

    This one liner make xml files 'act' as php files.
    AddType application/x-httpd-php .php .xml

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,268
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    parse XML files

    You could add this to the htaccess file
    Code:
    AddType application/x-httpd-php .xml

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2007
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this in your htaccess...
    Code:
    AddType application/x-httpd-php .xml
    This will read formats with the xml extension as PHP so you can write a PHP script that outputs the XML in the XML file.

    Looks like Mittineague beat me to it. lol
    Kayzio - We don't hesitate, we accelerate.

  6. #6
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,118
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Looks like Mittineague beat me to it. lol
    Looks like I beat you both!

    Thanks for the help,

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,268
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    posted answer

    Quote Originally Posted by markbrown4
    Looks like I beat you both!
    Unfair!!! I'm in a later timezone


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •