2014-01-30 30 views
0

这是推动我疯了..想不通什么是错在这里..mod_rewrite并没有 - 在所有

无法获得mod_rewrite的工作..没有..

所以我在这里尝试everyting重定向到google.com

的apache.conf(更新)

<VirtualHost *:80> 
    ServerName www.domain.com 
    DocumentRoot /var/www/domain.com/public/www 

    RewriteEngine on 
    RewriteRule^ http://www.google.com/ [L,R=301] 
</VirtualHost> 

的apache.conf

RewriteEngine on 

# Test 
RewriteRule^   http://www.google.com/ [L,R=301] 

# redirect non-active subdomains to 'www' 
RewriteCond %{HTTP_HOST} \.domain.com$ [NC] 
RewriteCond %{HTTP_HOST} !^(sub|www)\. [NC] 
RewriteRule^    http://www.domain.com [L,R=301] 

# put 'www' as subdomain if none is given 
RewriteCond %{HTTP_HOST} ^domain.com$ [NC] 
RewriteRule ^(.*)    http://www.domain.com/$1 [L,R=301] 

# www.domain.com 
<VirtualHost *:80> 
    ServerName www.domain.com 
    DocumentRoot /var/www/domain.com/public/www 
</VirtualHost> 

# sub.domain.com 
<VirtualHost *:80> 
    ServerName sub.domain.com 
    DocumentRoot /var/www/domain.com/public/sub 
</VirtualHost> 

不工作

这里你可以看到加载的模块

[email protected] /var/www/dyntest.dk # apache2ctl -M 
apache2: apr_sockaddr_info_get() failed for dyntest-amd-3700-2gb 
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName 
[Thu Jan 30 14:33:34 2014] [warn] NameVirtualHost *:80 has no VirtualHosts 
Loaded Modules: 
core_module (static) 
log_config_module (static) 
logio_module (static) 
version_module (static) 
mpm_prefork_module (static) 
http_module (static) 
so_module (static) 
alias_module (shared) 
auth_basic_module (shared) 
authn_file_module (shared) 
authz_default_module (shared) 
authz_groupfile_module (shared) 
authz_host_module (shared) 
authz_user_module (shared) 
autoindex_module (shared) 
cgi_module (shared) 
deflate_module (shared) 
dir_module (shared) 
env_module (shared) 
geoip_module (shared) 
mime_module (shared) 
negotiation_module (shared) 
php5_module (shared) 
reqtimeout_module (shared) 
setenvif_module (shared) 
status_module (shared) 
expires_module (shared) 
headers_module (shared) 
rewrite_module (shared) 
ssl_module (shared) 
Syntax OK 

回答

0

以下内容添加到您的.htaccess:ThisIsNotSupposedToWork!!!!。如果这不会产生内部服务器错误,则您的AllowOverride设置为None

+0

已更新我的问题..我没有使用htaccess这个..一切都在.conf – clarkk

+0

将您的重写配置移动到VirtualHost。 – mrjink

+0

已将重写移至虚拟主机,但仍无法正常工作..“apache.conf(更新)”问题已更新 – clarkk