douqian5553 2014-09-29 10:34
浏览 82

如何在不访问httpd-conf的情况下设置RSS feed

I was following a video tutorial on Youtube from phpacademy, to make a dynamic RSS feed. In order to do that I need to be able to use php inside my rss file.

In this video the guy mentions adding the following line to the HTTPD-Conf file in order to allow this.

AddType application/x-httpd-php .rss

I contacted my web host 123-reg and asked them

Do I have access to the HTTPD.Conf file, or is it already configured to allow this. I am looking to add the following line of code to the file if it isn't already in there.

AddType application/x-httpd-php .rss

What options do I have?

They responded with the following

The HTTPD.Conf file cannot be accessed with a shared hosting package as the one used to host the website for the domain This file is already configured to allow RSS, however you will need to enable it. You can try adding the handler into the .htaccess file.

Does this make any sense to someone, I don't really know what code I should be looking to add into my .htaccess file

  • 写回答

2条回答 默认 最新

  • dongyashun2559 2014-10-03 11:53

    After some more hunting around, and having looked up DaveG's code I wasn't sure it would do as I would have liked.

    I have a file with a .rss extension for my rss feed, so from my understanding of the above code, it would redirect you from filnename.rss to filename.php where as what I was looking to do was retain the .rss extension but allow that file to read and interpret the php within it.

    After some more searching I found that I could have used the original code from the video, and place it inside my .htaccess file instead on my httpd.conf file, I didn't realize that the code was interchangeable.

    AddType application/x-httpd-php .rss  // For older versions of php

    Anyway whilst looking for this solution I saw some using the line of code below to achieve the same result, the only real difference being it is for PHP5 and later which is whats running on my server so AddType is now AddHandler and we add a 5 to the end of php

    AddHandler application/x-httpd-php5 .rss  // For use with PHP5+
    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 mysql , 用自己创建的本地主机和用户名 登录不上
  • ¥15 关于#web项目#的问题,请各位专家解答!
  • ¥15 vmtools环境不正常
  • ¥15 请问如何在Ubuntu系统中安装使用microsoft R open?
  • ¥15 jupyter notebook
  • ¥30 informer时间序列预测
  • ¥20 SSR引物多态性分析
  • ¥15 大漠插件在Win11易语言注册调用和免注册灵异事件,VS上注册调用完全没问题
  • ¥15 Addressable缓存机制做热更新的问题
  • ¥15 微信开发者工具vant组件