我有一个正在工作的apache文件,但是在对其进行编辑后开始引发错误。不幸的是,我不是进行此编辑的人,因此我无法确切地说出它是什么,但是现在无法启动apache服务。我收到错误消息“ RewriteCond:错误的标志分隔符”,但无法放置该行到底有什么问题。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName $domain
ServerAlias www.$domain
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log conbined
RewriteEngine on
RewriteCond %{SERVER_NAME} = [OR]
RewriteCond %{SERVER_NAME} = mydomain.com [OR]
RewriteCond %{SERVER_NAME} = www.$domain
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
有问题的行是
RewriteCond %{SERVER_NAME} = mydomain.com [OR]
从我可以发现该错误通常是由于空白位置错误引起的。但是我不相信这种情况。告诉我所做的编辑是该行的域名已更改,假设从myolddomain.com
更改为mydomain.com
,但是将其更改回该错误仍然存在,因此我怀疑是它。我尝试将讨论的规则简化为不带[OR]的规则,但这无济于事。我还尝试将其括在引号中,但没有运气。
在此方面的任何帮助将不胜感激。