2013-09-21 80 views
1

我已经通过stackoverflow.com安静了一下,但我相信我没有找到我正在寻找的东西。所以,在这里。我有一个正确重定向的.htaccess文件,但我有一台远程测试服务器,它似乎不像我的开发人员机器那样重定向,可能这可能是服务器的apache2处理程序配置不正确? 好的,代码如下。现在.htaccess没有正确重定向

RewriteRule ^welcome?(.*)     public/index.php [L] 
RewriteRule ^profile?(.*)     public/index.php [L] 
RewriteRule ^password?(.*)     public/index.php [L] 
RewriteRule ^verify(.*)     public/index.php [L] 

RewriteRule ^(.*)$ main.php?%{QUERY_STRING}  [L] 

,在main.php文件能够处理所有进来,甚至欢迎,概况,密码,验证请求。但是现在,我想只将特定文件重定向到public/index.php文件,它在我的开发人员计算机中执行,但在远程服务器中执行?

+0

您是否在您的测试服务器上的apache中启用了mod_rewrite?文件public/index.php是否存在? –

回答

4
Options +FollowSymLinks -MultiViews 

RewriteEngine On 
RewriteBase/

RewriteRule ^(welcome|profile|password|verify) public/index.php [NC,L] 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} !^/(welcome|profile|password|verify) [NC] 
RewriteRule ^(.*)$ main.php [QSA,L] 

试试看。