【问题标题】:How to enable mod_rewrite on (apache 2.4) centos 7 for CodeIgniter Deployment?如何在(apache 2.4)centos 7 上为 CodeIgniter 部署启用 mod_rewrite?
【发布时间】:2016-07-26 17:14:02
【问题描述】:

我正在尝试解决我关于如何在 apache 2.4.6 上启用 mod_rewrite 模块的问题。我测试了一些我能找到的解决方案,但在我看来它不起作用。顺便说一句,我正在使用这个 .htaccess 配置:

 <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase /sats/  <-- name of my codeigniter directory
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
 </IfModule>   
 <IfModule !mod_rewrite.c> 
    ErrorDocument 404 /index.php 
 </IfModule>

我似乎仍然找不到启用模组重写的方法。我对 centOS 7 也不太熟悉。我的解决方案之一是将 /etc/httpd/conf/httpd.conf on 中的 AllowOverride None 更改为 AllowOverride All 。我似乎不明白为什么这不起作用。我还在 StackOverflow 上查看了一些解决方案,但它没有用。因此,非常感谢我没有做的任何建议或事情。如果您找到了一些解决方案,我也想尝试一下。谢谢!

【问题讨论】:

    标签: .htaccess mod-rewrite httpd.conf codeigniter-3 apache2.4


    【解决方案1】:

    在配置文件中添加“LoadModule rewrite_module modules/mod_rewrite.so”,目录写入“AllowOverride All”并重启apache。

    【讨论】:

    • 我会试试这个,但让我澄清一下我应该把它放在 httpd.conf 文件中吗?因为正如我在 apache 2.4 中观察到的,模块位于 conf.d 目录中。我应该在哪个部分插入这个?顺便谢谢你。
    猜你喜欢
    • 2015-08-31
    • 2016-05-09
    • 2016-04-05
    • 2017-06-19
    • 2018-08-04
    • 2015-01-27
    • 2019-02-16
    • 2016-06-07
    • 1970-01-01
    相关资源
    最近更新 更多