1

同じサーバーでホストされているサイトがいくつかありますが、それらすべてを管理していると思われる htaccess ファイルは 1 つだけです。では、これらのサイトの 1 つだけに対して、index.html の代わりに index.php をデフォルトにするにはどうすればよいでしょうか?

ありがとう!

# -FrontPage-


IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*


<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName site1.com
AuthUserFile /home/myuser/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/myuser/public_html/_vti_pvt/service.grp
AddHandler server-parsed .shtml
AddHandler server-parsed .html

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site1\.com
RewriteRule ^(.*)$ http://www.site1.com/$1 [R=permanent,L]
RewriteCond %{HTTP_HOST} ^(www\.)?site2\.com$ [NC]
RewriteRule ^(index\.html)?$ /index.php [L,NC]`
4

1 に答える 1

1

特定のサイトについてwww.site.com、.htaccess に次のルールを設定します。

RewriteCond %{HTTP_HOST} ^(www\.)?site\.com$ [NC]
RewriteRule ^(index\.html)?$ /index.php [L,NC]

推奨.htaccess:

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site1\.com
RewriteRule ^(.*)$ http://www.site1.com/$1 [R=permanent,L]

RewriteCond %{HTTP_HOST} ^(www\.)?site2\.com$ [NC]
RewriteRule ^(index\.html)?$ /index.php [L,NC]

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName site1.com
AuthUserFile /home/myuser/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/myuser/public_html/_vti_pvt/service.grp
AddHandler server-parsed .shtml
AddHandler server-parsed .html
于 2013-10-14T20:01:27.907 に答える