0

为什么每个页面都重定向到域?我移动 dkcherta.ru -> dkchertanovo.ru 并想要例如http://dkcherta.ru/index.php?id=80->http://dkchertanovo.ru/index.php?id=80

我的.htaccess:

    Options +FollowSymlinks -MultiViews
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?dkcherta\.ru$ [NC]
RewriteRule ^ http://dkchertanovo.ru/%{REQUEST_URI} [L,R=301]

RewriteRule ^rss_afisha[/]?$ /index.php?id=230 [L]
RewriteRule ^rss_news[/]?$ /index.php?id=231 [L]

ErrorDocument 404 http://dkchertanovo.ru/
# For full documentation and other suggested options, please see
# http://svn.modxcms.com/docs/display/MODx096/Friendly+URL+Solutions
# including for unexpected logouts in multi-server/cloud environments

RewriteBase /              

# Сливка доменного имени 
#RewriteCond %{HTTP_HOST} ^dkchertanovo\.ru$ [NC]
#RewriteRule ^(.*)$ http://www.dkchertanovo.ru/$1 [R=301,L]

RemoveHandler .php .htm .html
AddType application/x-httpd-php .php .htm .html
AddHandler application/x-httpd-php .php .htm .html
php_flag register_globals off

# Fix Apache internal dummy connections from breaking [(site_url)] cache
RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
RewriteRule .* - [F,L]

# Exclude /assets and /manager directories from rewrite rules
RewriteRule ^(manager|assets) - [L]

# For Friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 


### force www
    #RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
    #RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    #RewriteBase /


# Reduce server overhead by enabling output compression if supported.
#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 5
4

1 回答 1

2

您不需要多行这些:

Options +FollowSymLinks -MultiViews
RewriteEngine On 

只需在顶部放一次,它应该对文件的其余部分有效。

然后为了解决您的问题,将此规则移到文件中的所有其他规则之上.htaccess

RewriteCond %{HTTP_HOST} ^(www\.)?dkcherta\.ru$ [NC]
RewriteRule ^ http://dkchertanovo.ru%{REQUEST_URI} [L,R=301] 
于 2013-09-06T14:09:32.093 回答