0

这是我的 /etc/apache2/sites-availables/mysite.com 文件配置

ServerAdmin LOLILOL@LOL.com

ServerName www.example.com
Redirect permanent / http://www.example.com/

ServerAlias example.com

DocumentRoot /home/example/www
SuexecUserGroup example example
<Directory />

Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
<Directory /home/example/www>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined

请有人告诉我在哪里可以找到将非 www 重定向到 www 的问题?

PS:我无法从http://example.com访问我的网站(仅来自http://www.example.com /)

请帮帮我 !!!!

4

1 回答 1

0

我在 .htaccess 中执行此操作。

RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
于 2014-12-17T03:31:12.603 回答