配置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.

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.