使用htaccess重定向

使用htaccess重定向

问题描述:

I want to redirect '/' or '/index' to '/user' action in zend2. I googled it but still I haven't found a solution.

The htaccess code is:

SetEnv "APP_ENV" "developement"

Options +FollowSymLinks
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)/$ /$1 [R,L]
RewriteRule ^.*$ index.php [NC,L]

我想在zend2中将'/'或'/ index'重定向到'/ user'动作。 谷歌搜索 它仍然没有找到解决方案。 p>

htaccess代码是: p>

  SetEnv“APP_ENV”“developpement”
  
Options + FollowSymLinks 
RewriteEngine On 
RewriteCond%{REQUEST_FILENAME} -s [OR] 
RewriteCond%{REQUEST_FILENAME} -l [OR] 
RewriteCond%{REQUEST_FILENAME} -d 
RewriteRule ^。* $  -  [NC,L] \  nRewriteRule ^(。*)/ $ / $ 1 [R,L] 
RewriteRule ^。* $ index.php [NC,L] 
  code>  pre> 
  div>

The solution for me is:

SetEnv "APP_ENV" "developement"

RewriteEngine On 

Options +FollowSymLinks
RewriteBase /

RewriteRule ^index\.php$ - [L]
RewriteRule ^$ user [R=301,L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)/$ /$1 [R,L]
RewriteRule ^.*$ index.php [NC,L]