1

我正在使用 symtfony 1.4,我有一个名为 backend 的模块,它的索引文件是

www.domain.com/backend.php

但是我希望当我在浏览器上写 www.domain.com/back 时将我重定向到

www.domain.com/backend.php

我尝试使用此规则

RewriteRule ^/back$ www.domain.com/backend.php

但它不起作用。

这是我的 .htaccess

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  #RewriteCond %{REQUEST_URI} \..+$
  #RewriteCond %{REQUEST_URI} !\.html$
  #RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteRule ^/back$ www.domain.com/backend.php 

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
4

1 回答 1

0

尝试改变:

  RewriteRule ^/back$ www.domain.com/backend.php 

  RewriteRule ^back$ http://www.domain.com/backend.php [L]
于 2012-08-24T21:35:37.077 回答