2013-11-26 4 views
1

Как я могу переписать URL-адрес, чтобы включить www. и не вызывать проблему с бесконечным циклом? У меня проблема с перенаправлением URL. Мне нужно убедиться, что www. добавляется к URL. Я понимаю, что это должно быть сделано в .htaccess и после того, как немного исследований и чтения, я думаю, что код мне нужноrewrite htaccess вызывает бесконечный цикл?

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example.co.uk [NC] 
RewriteRule ^(.*)$ http://www.example.co.uk/$1 [R=301,L] 

Это сайт Joomla поэтому секция затем следует секция SEF Joomla

## Begin - Joomla! core SEF Section. 
# 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
# 
# If the requested path and file is not /index.php and the request 
# has not already been internally rewritten to the index.php script 
RewriteCond %{REQUEST_URI} !^/index\.php 
# and the request is for something within the component folder, 
# or for the site root, or for an extensionless URL, or the 
# requested URL ends with one of the listed extensions 
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC] 
# and the requested path and file doesn't directly match a physical file 
RewriteCond %{REQUEST_FILENAME} !-f 
# and the requested path and file doesn't directly match a physical folder 
RewriteCond %{REQUEST_FILENAME} !-d 
# internally rewrite the request to the index.php script 
RewriteRule .* index.php [L] 
# 
## End - Joomla! core SEF Section. 

Если я использую этот светлячок предупреждает меня:

The page isn't redirecting properly 

Firefox has detected that the server is redirecting the request for this address in a way that will never complete. 

IE не может найти страницу Если удалить строки переписывают я получаю т он страницы, но URL-адрес переписан на один без www

Как я могу заставить www. быть в URL-адресе?

ответ

1

Кажется, что правила перезаписи действительно работают, я обнаружил, что панель plesk имеет возможность для доменов, чтобы заставить их быть www. или не www. и это может означать конфликт между .htaccess и настройками домена для хоста. Это означает, что URL-адрес не разрешен.

Когда я сменил панель управления на отсутствие правил перезаписи, работала так, как ожидалось.

Смежные вопросы