2012-01-15 43 views
0

這裏就是我想要做:爲什麼RewriteBase不能正常工作?

  • 域名thinkingmonkey.me
  • 域有127.0.0.1作爲IP地址
  • mod_alias中安裝

我有一個名爲directories.conf conf文件。其中我有所有有關目錄的配置。 directories.conf包括在httpd.conf

directories.conf

Alias /runs /xhprof/xhprof_html 

<Directory /mysite/xhprof/xhprof_html> 
    Order allow,deny 
    Allow from all 
    AllowOverride All 
</Directory> 

/mysite/xhprof/xhprof_html/.htaccess。我有以下幾點:

RewriteEngine on 
RewriteBase /runs 
RewriteRule .* index.php 

所有我試圖做的是直接/mysite/xhprof/xhprof_html/index.php的任何請求。

當我要求thinkingmonkey.me/runs沒有後斜線我得到404 not found

所以,我推斷RewriteBase不起作用。
我在做什麼錯?

+0

嘗試改用'RewriteBase:/運行/' – Cyclonecode 2012-01-15 19:56:14

+0

@KristerAndersson不會鐵鍋 – ThinkingMonkey 2012-01-15 20:17:18

+0

指數。 php在'/ mysite/xhprof/xhprof_html /'不是嗎? – regilero 2012-01-15 20:58:47

回答

0

別名需要一個尾部斜線。與RewriteBase無關。

雖然您可以在需要時使用重寫規則添加斜線。喜歡的東西:

RewriteRule ^run$ /run/ [R=301,L] 

將這個規則在htaccess的在您的服務器的根目錄(不/xhprof/xhprof_html

+0

您發佈的規則將只適用於域名/運行,即以運行結束,我試圖通過文件夾xhprof_html將任何請求重定向到index.php – ThinkingMonkey 2012-01-15 20:27:11

+2

別名不需要如果你在第一部分有一個,那麼在第二部分中需要一個。 http://httpd.apache.org/docs/2.1/mod/mod_alias.html#alias – regilero 2012-01-15 21:44:55

+0

@ThinkingMonkey這隻解決了你所遇到的'domain/run'問題。我認爲這是你唯一的問題。請重新說明我有任何其他問題。 – Gerben 2012-01-16 16:14:08