linux - 在 httpd.conf 中保留 VirtualHost RewriteRule

标签 linux apache mod-rewrite virtualhost httpd.conf

我已经用 RewriteRule 编辑了 httpd.conf,它看起来像这样:

    <VirtualHost myip:80>
        ServerName mysite.com
        ServerAlias mail.mysite.com www.mysite.com
        RewriteEngine on
        RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
        JkMount /* mysite
        ...

它工作正常,但是当重建 httpd.conf 时,我所做的所有更改都丢失了。我尝试编辑 pre_virtualhost_global.conf 但没有成功,如果有人能确切地告诉我我必须放什么以及放在哪里,我将不胜感激。

感谢您的宝贵时间。

最佳答案

您提到有一个 pre_virtualhost_global.conf 文件,所以我假设您有 WHM/cPanel。为了修改 Apache 虚拟主机,您使用包含文件,如 WHM/cPanel 的 official documentation 中所述。 .

关于linux - 在 httpd.conf 中保留 VirtualHost RewriteRule,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49701396/

相关文章:

c - Linux内核模块复制进程的.text段

python - IO 错误 - 抓取网络时 - 代理问题?

Apache带参数重写规则?

php - 使用 RewriteRule 后样式表不加载并包含

regex - mod_rewrite regex 仅在某个字符串不存在时才匹配

regex - 与 RewriteRule 精确匹配,无需正则表达式

linux - 为特定目标平台设置交叉编译环境

linux - 以下 Linux 代码的 Windows 变体

ruby - 如何将 apache 日志时间转换为 activerecord :datetime

apache - Htaccess 重定向 - 将许多规则合并到一个重定向中