虚拟主机和htaccess问题以及yii项目设置中的重定向过多

时间:2016-01-12 17:14:11

标签: php apache .htaccess mod-rewrite yii

该项目在yii 1.1上。我在htdocs文件夹下设置了项目。它重定向次数太多了。我还为它设置了一个虚拟主机。

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/message_board"
ServerName message_board.dev
ServerAlias www.message_board.dev
<Directory "c:/xampp/htdocs/message_board">
Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
</Directory>

以下是.htaccess代码

Options +FollowSymLinks
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# if request is not for the /sts/
RewriteCond %{REQUEST_URI} !^/sts/ [NC]
# otherwise forward it to index.php
RewriteRule . index.php

1 个答案:

答案 0 :(得分:0)

尝试进行以下更改。

更改为虚拟主机文件:

<Directory "c:/xampp/htdocs/message_board">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

.htaccess更改:

Options -Multiviews
Options +FollowSymLinks
RewriteEngine on
RewriteBase /

# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php