douqian5553 2014-09-29 10:34
浏览 82
已采纳

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

I was following a video tutorial on Youtube from phpacademy, https://www.youtube.com/watch?v=hxWYeCGa-PA&index=6&list=WL 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 vwrx-project.co.uk. 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+
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!