1

我在同一台服务器上托管了几个站点,但是我猜只有一个 htaccess 文件可以控制所有站点。那么我怎样才能让 index.php 成为这些网站之一的默认值,而不是 index.html 呢?

谢谢!

# -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 回答