2015-10-06 20 views
0

我想下面的行添加到我的Apache的httpd.conf文件Apache的httpd.conf問題與重寫

Alias /my_ember_proj "C:\my_ember_code\dist" 
<Directory "C:\my_ember_code\dist"> 
Order allow,deny 
Allow from all 
Options Indexes FollowSymLinks 
AllowOverride None 
Require all granted 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /my_ember_proj/index.html#$1 [L] 
</Directory> 

(我在Windows 7有2.2版本),但是下面幾行是失敗

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /my_ember_proj/index.html#$1 [L] 

我知道這是因爲服務器啓動時沒有這些4線(我不知道在哪裏可以找到任何特定的故障細節......沒有看到任何具體的錯誤日誌中的文件夾)

請你H幫我解決這個問題。

+0

AFAIK,Apache 2.2不接受'Require all all granted' – hjpotter92

+0

問題的後續處理? – hjpotter92

回答

0

正如在評論中已經提到的那樣,mod_authz_host提供的Require指令在Apache 2.2中不可用。 Apache 2.3及更高版本中的module was introduced

因此,首先檢查Apache服務器是否確實是2.2。

接下來,確認the rewrite module是否已被加載。在同一httpd.conf文件,搜索以下:

LoadModule rewrite_module modules/mod_rewrite.so 

如果有#前述它,取出#符號,保存文件並重新啓動服務器。