Apache重写:如果不存在/ public open /public/index.php/

时间:2013-03-19 12:24:11

标签: apache mod-rewrite

我想要

  1. http://kemtime2_neu.pr.domain.de/css/style.csshttp://kemtime2_neu.pr.domain.de/public/css/style.css
  2. 打开
  3. http://kemtime2_neu.pr.domain.de/loginhttp://kemtime2_neu.pr.domain.de/public/index.php/login
  4. 打开

    我有

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /public/index.php/$1 [L]
    

    适用于2。

    如何让它适用于1.?请注意,我无法更改文档根目录(抱歉!)。

2 个答案:

答案 0 :(得分:0)

将您的DocumentRoot更改为指向public目录?

答案 1 :(得分:0)

找到它:

# Redirect to static content
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond /var/www/de/domain/pr/kemtime2_neu/public%{REQUEST_URI} -f
RewriteRule ^(.+)$ /public/$1 [L]

# otherwise redirect to script
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public/index.php/$1 [L]