【问题标题】:Mod-rewrite not working centosMod-rewrite 不工作 centos
【发布时间】:2014-01-19 06:33:59
【问题描述】:
<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.am [NC]
RewriteRule ^(.*)$ http://example.am/$1 [L,R=301]
</IfModule>

为什么不行,我在/etc/httpd/conf/http.conf最后加上了,我确定了

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>

<Directory "/var/www/html">

是因为我的网站在 /srv/www/domain/public_html 中吗?

【问题讨论】:

  • 您的网站是 www.example.am,并在其 vhost 定义中如此定义?
  • 不,我把我的网址拿出来了,但我以前有我的网址,它仍然不起作用?
  • 也许 mod_rewrite 没有加载?不要像这样使用 IfModule!

标签: php apache mod-rewrite vps


【解决方案1】:

将 Mod 重写代码移动到网络服务器根目录中的 .htaccess 文件(即 /srv/www/domain/public_html 服务器)

重新启动 Apache 服务(或 nginx,具体取决于您使用的服务器),这应该将 mod-rewrite 应用到您的站点。

【讨论】:

    猜你喜欢
    • 2011-05-12
    • 2014-11-26
    • 2012-07-21
    • 2011-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-01
    • 1970-01-01
    相关资源
    最近更新 更多