RSS feed URL

Need help for URL Rewrite,I need to my rss feed like

http://exampleproject/feed (No need .xml)

My current URL structure is like below :

http://exampleproject/feed.xml

You want to look up the redirect rules for your web server. I use Apache, so in my .htaccess I have:

# Redirect WordPress RSS URL to Hugo feed
Redirect 302 /feed/ /index.xml

I use a 302 for a specific reason, so you’ll want to look up which code to pass for your situation. :slight_smile:

1 Like

As per your suggestion URL redirection is working.But xml content wont displaying.Any chance to display xml content without using extension ‘.xml’

You can use

RewriteRule ^feed$  /index.xml [P]
RewriteRule ^feed/$ /index.xml [P]

I tested this with a number of browsers, all of which recognise /feed/ as xml.

1 Like

Thanks for your reply.it worked with htacess.Is it possible to do the same with hugo config or netlify settings? My Hugo website is hosted in netlify.

Thanks

Yes, see examples here on how to sets redirects in netlify.toml itself.

Traditionally redirects were set in the _redirects file (that still works), but now everything can be done in that TOML file.

1 Like

Here is an example from my Netflify _redirects file:

# Redirects instructions for deployment via Netlify
# -- TEST: Paste this into: https://play.netlify.com/redirects -- #

# -- index.php showing up a lot in Google Searches -- #
/index.php                   /

# -- Redirect from /post/# and /posts/# to /blog/#
/post/*                      /blog/:splat
/posts/*                     /blog/:splat

# -- Redirect from /topics to /categories
/topics/*                    /categories/:splat

# -- Bye bye WordPress -- #
/wp-admin/index.php          /blog/switching-from-wordpress-to-hugo

# -- Have to redirect old WordPress feed urls -- #
/feed                        /feed.xml
/categories/rss/feed         /categories/feed.xml
/tags/rss/feed               /tags/feed.xml
/*/feed                      /:splat/feed.xml

# -- Seem to be still getting index.php access -- #
/*/index.php                 /:splat

# -- Comments pages showing in bing Searches -- #
/*/comment-page-1            /:splat

# -- Invalid sitemap name -- #
/site.xml/                   /sitemap.xml

As you can see, I’ve moved from Wordpress to Hugo/Netlify.

Note that the _redirects file has to go in your /static folder, that isn’t immediately obvious from the Netlify docs.

2 Likes

These redirects should work:

[[redirects]]
  from = "/feed"
  to = "/index.xml"
  status = 200
  force = true

[[redirects]]
  from = "/feed/"
  to = "/index.xml"
  status = 200
  force = true

The status = 200 part redirects without changing the URL shown in the browser’s address bar.

2 Likes

Worked…Thanks a lot…

A post was split to a new topic: Netlify redirects