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条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么