mod-undrite不起作用的centos


<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>

为什么它不起作用,我补充说,在/httpd/conf/http.conf中,我确保

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
<Directory "/var/www/html">

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

将mod重写代码移动到Web服务器根(即/srv/www/domain/public_html Server)中的.htaccess文件

重新启动Apache服务(或NGINX,取决于您使用的服务器),该服务应将mod-Rewrite应用于您的网站。

最新更新