![](/img/trans.png)
[英]Error in custom php.ini: “Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration”
[英]Invalid command 'location', perhaps misspelled or defined by a module not included in the server configuration
目前,我正在为一个项目设置我的本地环境。
项目在带有 nginx 服务器的生产环境中运行。 但是在本地开发,使用apache服务器。 我已经在我的 ubuntu 机器上安装了 LAMP 堆栈。 已经提供了一个虚拟主机文件,我已经设置了它。 到目前为止,我已经在/etc/apache2/sites-available
下创建了xxx.conf
文件。
该文件包括:
<VirtualHost *:80>
ServerName xxx
DocumentRoot /home/ubuntuser/Downloads/xxx-master/public
<Directory "/home/ubuntuser/Downloads/xxx-master/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/xxx-error.log
CustomLog ${APACHE_LOG_DIR}/xxx-access.log combined
SetEnv ENVIRONMENT "development"
</VirtualHost>
我还在/home/ubuntuser/Downloads/xxx-master/public
下创建了 .htaccess 文件。 从生产环境下载的这个文件的内容。
.htaccess
文件的内容是:
RewriteEngine On
RewriteBase /
location ~ ^/site { rewrite ^/site(.*)$ https://local.xxx.com/$1 redirect;}
因此,当我在浏览器中输入local.xxx.com
时,它会给出 500 内部错误。
所以,我在虚拟主机配置文件中定义了xxx-error.log
。 我已经打开了。 内容是:
[Tue May 28 22:23:33.231851 2019] [core:alert] [pid 5677] [client 127.0.0.1:56504] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context
[Tue May 28 22:23:33.254608 2019] [core:alert] [pid 5678] [client 127.0.0.1:56506] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context, referer: http://local.xxx.com/
[Tue May 28 22:33:22.300863 2019] [core:alert] [pid 6326] [client 127.0.0.1:56740] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: Invalid command 'location', perhaps misspelled or defined by a module not included in the server configuration
[Tue May 28 22:33:22.317420 2019] [core:alert] [pid 6327] [client 127.0.0.1:56742] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: Invalid command 'location', perhaps misspelled or defined by a module not included in the server configuration, referer: http://local.xxx.com/
所以,我知道.htaccess
存在问题,但我不知道如何解决。
您正在使用 apache 并在您的 .htaccess 中使用 Nginx 的约定。
参考apache2.4的最新文档
对我来说似乎你想重定向使用这个
RewriteRule ^/site(.*)$ https://local.xxx.com/$1
或者这个
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.