/forum/index.php incepe cam asa (am luat din v1.1.4):
<?php
// Hack
if ((!preg_match("@www@i", $_SERVER['HTTP_HOST'], $_dummyMatch))&&(preg_match("@linuxsoft\.ro@i", $_SERVER['HTTP_HOST'], $_dummyMatch)))
{
$_urlHead = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? "https://www." : "http://www.";
$_redirURL=$_urlHead.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $_redirURL");
die();
}
// End Hack
/**********************************************************************************
* index.php *
***********************************************************************************
* SMF: Simple Machines Forum *
* Open-Source Project Inspired by Zef Hemel (zef@zefhemel.com) *
* =============================================================================== *
* Software Version: SMF 1.1.4 *
* Software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2006-2007 by: Simple Machines LLC (http://www.simplemachines.org) *
* 2001-2006 by: Lewis Media (http://www.lewismedia.com) *
* Support, News, Updates at: http://www.simplemachines.org *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
?>
Se vede unde am plasat micul hack pentru 301 redirect (deci nu are implicatii asupra indexarii URL-urilor fara www si nici asupra uzabilitatii). Nu trebuie sa existe nici un whitespace intre inceputul fisierului si <?php pentru ca va fi trimis ca output. Banuiesc ca problema este in .htaccess, m-am lovit si eu de multe ori de balarii de astea de nu facea redirectul exact cum voiam sa il faca, desi am citit n-turoriale de .htaccess, deci am scris bucata asta de cod PHP care rezolva problema fara aportul serverului HTTP.
Offtopic: as veni desi mi-e naspa sa fac atata drum pentru atat de putin timp avand in vedere ca inca nu am un mijloc de transport propriu (problema in curs de rezolvare), nu cunosc Bucurestiul (am fost doar de cateva ori). In plus, s-ar putea saptamana viitoare sa fiu plecat (nu este sigur, dar daca trebuie sa plec, trebuie sa plec - este o chestie ce nu suporta alternativa din pacate).