Jump to content

PHP as XML using Mod-Re-write


Recommended Posts

Hi.

 

I have a neat little script which outputs my database as XML here:

http://98.131.0.168/~truro/sitemap.php

 

I'm trying to use Mod Re-Write to tell google and others that the PHP script is a XML page by adding this to a .htaccess file:

RewriteRule (.*)\.xml(.*) $1.php$2 [nocase]

 

It's just not working. Here's the URL: http://98.131.0.168/~truro/sitemap.xml

 

Any suggestions?

Link to comment
Share on other sites

This header is already there.

 

The PHP page is working fine, but the mod re-write will not recognise the PHP page as an XML page.

 

I need this to work so that Google can look for sitemap.xml and find the PHP page that accesses my database.

 

Mod rewrite's working for other pages, but seems to have a problem with the line (above) which changes an XML page into a PHP one.

 

Neil

Link to comment
Share on other sites

No I don't think you're getting what I mean....

The file works fine.

 

Mod re-write is used to handle URL parsing. I want someone to enter "sitemap.xml" into their browser and be directed to the "sitemap.php" page that already works fine.

 

This is a mod-rewrite issue, not a PHP/XML one. that's why this post is in this forum as opposed to anywhere else.

 

I hope that helps.

Link to comment
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.