Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [php]Strona z "www"się nie wyświetla a bez tak
Forum PHP.pl > Forum > Przedszkole
darkowski
Witam mam pewien problem ze stroną ponieważ jak wpisze adres bez "www" to strona działa a jak z "www" to wychodzą błędy
Chodzi o strone www.amnezja.net.pl i amnezja.net.pl
Poniżej kod od lini 270 w którym coś trzeba zmienić tylko nie wiem co

  1. $this->registry->template->assign('SHOP_LOGO', $this->layer['photoid']);
  2. $logo = '_images_frontend/core/logos/' . $this->layer['photoid'];
  3. $size = @getimagesize(ROOTPATH . 'design/' . $logo);
  4. $path = DESIGNPATH . $logo;
  5. $width = isset($size[0]) ? $size[0] : 150;
  6. $height = isset($size[1]) ? $size[1] : 100;
  7. $logoCss = "a.logo{float:left;width:{$width}px;height:{$height}px;text-indent:-999px;margin-top:25px;background: url('{$path}') no-repeat;}";
  8. $this->registry->template->assign('logoCSS', $logoCss);
  9. $this->registry->template->assign('FAVICON', $this->layer['favicon']);
  10. $this->registry->template->assign('faceboookappid', $this->layer['faceboookappid']);
  11. $this->registry->template->assign('enableregistration', $this->layer['enableregistration']);
  12. $this->registry->template->assign('client', $client);
  13. $this->registry->template->assign('clientdata', $client);
  14. $this->registry->template->assign('showtax', $session->getActiveShowTax());
  15. $this->registry->template->assign('currencySymbol', $session->getActiveCurrencySymbol());
  16. $this->registry->template->assign('count', $cartModel->getProductAllCount());
  17. $this->registry->template->assign('globalPrice', $cartModel->getGlobalPrice());
  18. $this->registry->template->assign('productCart', $productCart);
  19. $this->registry->template->assign('language', $session->getActiveLanguageId());
  20. $this->registry->template->assign('languageCode', $session->getActiveLanguage());
  21. $this->registry->template->assign('languageFlag', $languageModel->getLanguages());
  22. $this->registry->template->assign('currencies', $languageModel->getAllCurrenciesForView());
  23. $this->registry->template->assign('breadcrumb', App::getModel('breadcrumb')->getPageLinks());
  24. $this->registry->template->assign('contentcategory', App::getModel('staticcontent')->getContentCategoriesTree());
  25. $this->registry->template->assign('gacode', $this->layer['gacode']);
  26. $this->registry->template->assign('gapages', $this->layer['gapages']);
  27. $this->registry->template->assign('gatransactions', $this->layer['gatransactions']);
  28. $this->registry->template->assign('enablerating', $this->layer['enablerating']);
  29. $this->registry->template->assign('enableopinions', $this->layer['enableopinions']);
  30. $this->registry->template->assign('enabletags', $this->layer['enabletags']);
  31. $this->registry->template->assign('confirmorder', $this->layer['confirmorder']);
  32. $this->registry->template->assign('enablerss', $this->layer['enablerss']);
  33. $this->registry->template->assign('catalogmode', $this->layer['catalogmode']);
  34. $this->registry->template->assign('cartpreview', $cartModel->getCartPreviewTemplate());
  35. if ($this->layer['cartredirect'] != ''){
  36. $this->registry->template->assign('cartredirect', App::getURLAdress() . App::getRegistry()->core->getControllerNameForSeo($this->layer['cartredirect']));
  37. }
  38.  
tomi1985
kolego do tego słuzy plik htaccess wink.gif

  1. # przekierowanie dla przykładu bez www -> www
  2. RewriteCond %{HTTP_HOST} !^www.
  3. RewriteRule ^(.*)$ <a href="http://www.%{HTTP_HOST}/$1" target="_blank">http://www.%{HTTP_HOST}/$1</a> [R=301,L]
IProSoft
kolego, a Ty skąd takiego potworka .htaccess wytrzasnąłeś smile.gif questionmark.gif

Kod
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
tomi1985
przekierowanie domeny na bez www na www wink.gif chyba, że coś źle zrozumiałem biggrin.gif
IProSoft
Chodzi o zawartośc twojego kodu, gdzie widziałeś kod HTML w pliku .htaccess ?
trueblue
Chodzi chyba o PHPCode, które wygenerowało link.
darkowski
Nie wiem ale wpisałem ten kod i umieściłem .htaccess na serwerze ale i tak nie działa

  1. Options +FollowSymLinks
  2. RewriteEngine on
  3. RewriteCond %{HTTP_HOST} ^amnezja.net.pl [nc]
  4. RewriteRule ^(.*)$ <a href="http://www.amnezja.net.pl/$1" target="_blank">http://www.amnezja.net.pl/$1</a> [r=301,nc]
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.