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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵