doushi7314 2015-12-21 19:14
浏览 45

配置htaccess目录索引文件

Scenario: I created this htacces file to redirect subdomains. So far it works.

<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.example\.net$ [NC]
RewriteRule ^(.*) http://example.net/%1/$1 [P,NC,QSA]
</IfModule>

Problem:

It forces the server to request an arbitrary index.php which doesn't exist. What I do have is index.html, so I'm getting:

Error 404: /xyz/index.php was not found on this server

I tried adding:

DirectoryIndex index.html index.php [L]

But only 1st argument gets accepted, the 2nd gets ignored (why?). AFAIK it should accept either of those as long as either exist.

  • 写回答

1条回答 默认 最新

  • dousi7919 2015-12-21 19:24
    关注

    try this: i copy this and work right.

    <IfModule mod_rewrite.c>
    
        RewriteEngine on
    
        RewriteRule    ^$    public/    [L]
    
        RewriteRule    (.*) public/$1    [L]
    
    </IfModule>
    

    you should change 'public' to your folder.

    评论

报告相同问题?

悬赏问题

  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛