如何在虚拟主机中更新.htaccess


How to update .htaccess in virtual host

今天我从一位UI开发人员那里得到了一个网站。我把所有的*.html代码都改成了*.php。它在本地服务器上运行良好。在网上发布后,我给

Failed to load resource: the server responded with a status of 500 (Internal Server Error) 

在谷歌上搜索后,我了解到我需要更改.htaccess文件。数字海洋

但几天前我制作了虚拟主机。我无法获得

/etc/apache2/sites-available/default

相反,我在/etc/apache2/可用站点/中得到了三个文件。

000-default.conf  default-ssl.conf  tangelotown.org.conf

tangeloton.org.conf的内容是

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    ServerName tangelotown.org
    ServerAlias www.tangelotown.org
    ServerAdmin president@tangelotown.org
    DocumentRoot /var/www/tangelotown.org/public_html
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

此文件不包含

<Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
 </Directory>

如现场所述。请帮我解决这个问题。我的网站是tangeloton.org

尝试在VirtualHost节之前添加Directory节,但您可能想要更改Directory

<Directory /var/www/tangelotown.org/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
 </Directory>

这个问题的简单答案是它有php错误。

Failed to load resource: the server responded with a status of 500 (Internal Server Error) 

上面的错误表明php代码有问题。我使用require_one(")并删除了所需的文件。在考虑这些问题之前,请查看错误日志。