duanluan8390 2019-07-30 20:41
浏览 72

如果index.php不在url中,则在所需文件中使用URI嵌入图像的服务器错误

Struggling. Help!

In index.php:

require "cachedPages/home.html";

If I visit: https://websiteaddress.org/index.php then it works fine.

If I visit: https://websiteaddress.org then I get an internal server error.

I guess it's a .htaccess thing. All I have in there is some cpanel php72 code and:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
DirectoryIndex index.php

It seems there's some difference between how index.php is called if you call it directly as opposed to .htaccess calling it for you?!?

Any ideas?

Thanks in advance.

  • 写回答

2条回答 默认 最新

  • duanlian1320 2019-07-30 22:00
    关注

    If you don't have one of the following options in your .htaccess then Apache won't know which file to default back to:

    DirectoryIndex index.php
    FallBackResource /index.php
    

    Also I'd recommend installing mod_rewrite as well. It's handy for other reasons.

    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?