Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-09-20 10:44:30

beechy
Member
Registered: 2006-03-02
Posts: 92

Add a .xml suffix to my textpattern generated url - /sitemap

Hi,

I have created a .xml sitemap for my textpattern website at www.#####.com/sitemap

I want to be able to rewrite this url so that it shows as www.#####.com/sitemap.xml

I have tried to use gbp_permanent_links to add the .xml suffix however when I only add the rule for the suffix and nothing else it seems to interfer with some of the other pages on my site, redirecting those to my default page even though I have selected the /sitemap section only in gbp_permanent_links.

Is there a way to manually rewrite the textpattern url I have generated (www.#####.com/sitemap) to www.#####.com/sitemap.xml using some kind of .htacess rewrite rule?

- I know there are a few textpattern sitemap.xml plugins out there. However I have used these on previous projects and found that they are not as flexible as I need, and always seem to include urls that I dont want and am not able to remove.

Thanks in advance…

Last edited by beechy (2011-09-20 10:46:31)

Offline

#2 2011-09-20 11:49:34

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: Add a .xml suffix to my textpattern generated url - /sitemap

I use rah_external_output for this in a similar way. If you have an item called “sitemap_xml” and place your form in there, then set the content type to application/xml or text/xml, you can direct google sitemaps to www.domain.com/?rah-external_output=sitemap_xml. If you really want sitemap.xml as the name, you can add the following to your htaccess:

RewriteRule ^sitemap.xml$ index.php?rah-external_output=sitemap_xml

You can do a similar thing with your page section. You can set the correct content type using mg_setheader and use the following htaccess RewriteRule:

RewriteRule ^sitemap.xml$ index.php?s=sitemap

TXP Builders – finely-crafted code, design and txp

Offline

#3 2011-09-20 11:53:41

beechy
Member
Registered: 2006-03-02
Posts: 92

Re: Add a .xml suffix to my textpattern generated url - /sitemap

amazing thanks for that jakob.

Offline

Board footer

Powered by FluxBB