2017-10-31 2 views
0

PHPを7.0にアップグレードするには、Ubuntu 14から16.04.3全体を再インストールする必要がありました。今はマシンにUbuntu 16がありますが、私のウェブサイトは壊れています。それはApacheとmod_rewriteを使用していました。サーバでRewriteRuleを使用しているときブラウザに404が見つかりません。

サーバーで
... 
<VirtualHost *:80> 
     ServerName api.example.com 
     ServerAdmin [email protected] 
     DocumentRoot /var/www/api.example.com 
     <Directory "/var/www/api.example.com"> 
       Options -Indexes 
     </Directory> 
     ErrorLog ${APACHE_LOG_DIR}/api.example.com.error.log 
     CustomLog ${APACHE_LOG_DIR}/api.example.com.access.log combined 
</VirtualHost> 
... 

/etc/apache2/sites-available/000-default.conf

:私のクライアントで

[email protected]:/var/www/api.example.com$ ls -l .htaccess dir 
-rw-rw-r-- 1 janos janos 65 okt 31 09:10 .htaccess 

dir: 
total 4 
-rw-rw-r-- 1 janos janos 6 okt 31 09:09 hello.txt 
[email protected]:/var/www/api.example.com$ cat .htaccess 
RewriteEngine On 
RewriteRule "^test.txt$"  "dir/hello.txt" 
[email protected]:/var/www/api.example.com$ sudo service apache2 restart 
[email protected]:/var/www/api.example.com$ sudo a2enmod rewrite 
Module rewrite already enabled 

私は何
mymachine:Downloads janos$ curl -Is http://api.example.com/test.txt|grep HTTP 
HTTP/1.1 404 Not Found 
mymachine:Downloads janos$ curl -Is http://api.example.com/dir|grep HTTP 
HTTP/1.1 301 Moved Permanently 
mymachine:Downloads janos$ curl -Is http://api.example.com/dir/|grep HTTP 
HTTP/1.1 403 Forbidden 
mymachine:Downloads janos$ curl -Is http://api.example.com/dir/hello.txt|grep HTTP 
HTTP/1.1 200 OK 
mymachine:Downloads janos$ 

行方不明?

+0

'ヤーノシュ例:@ /var/www/example.hej.hu$のphp -i | grepをrewrite' _url_rewriter.tags => A = HREF、面積= HREF、フレーム= src、input = src、form = fakeentry => a = href、area = href、frame = src、input = src、form = fakeentry_ – Janos

答えて

0

私の間違いは、ユーザー定義のhtaccessファイルでmod_rewriteやその他のルールを変更できなかったことです。正しい設定一部です:

<Directory "/var/www/api.example.com"> 
      Options -Indexes 
    # it's working now with this following 1 line added: 
      AllowOverride all 
    </Directory> 
関連する問題