Citat: DarioORION] link=topic=4196.msg14095#msg14095 date=1362731593]
ovaj kod
RewriteCond %{HTTP_HOST} ^apartmani-stara-novalja\.com [nc]
RewriteRule (.*) http://www.apartmani-stara-novalja.com/$1 [R=301,L]
RewriteRule ^(([^/]+/)*)index\.php http://www.apartmani-stara-novalja.com/$1 [R=301,L]
zamijeni s ovim
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
i sada možeš svoj .htaccess koristiti na bilo kojoj domeni/stranici jer ime domeni nije "hard kodirano" :)
hvala puno
Stranicu sam provjeravala s http://www.ragepank.com/redirect-check/
i pokazalo se da prilog 1 iz toga se zaključuje da je problematična stranica http://www.apartmani-stara-novalja.com/index.php
koju bi trebalo preusmjeriti 301 na http://www.apartmani-stara-novalja.com
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ http://www.apartmani-stara-novalja.com/$1 [R=301,L]
to bi trebala ubaciti ali ne znam da i sve stavke koda ili samo zadnje tri ? i da li može to biti isto univerzalno kao što si navoe kodove u predhodnom meilu?
tu se javlja još jedno upozorenje ali to stvarno ne razumijem gdje bih ga trebala unbaciti:
to je ovo:
How to do a 301 redirect
If you ever need to do a redirect in PHP code, make sure that you do more than just the default - ie not just the R, but the R=301 in the htaccess, or not only the "Location", but also the initial 301 Moved Permanently code. The default redirect is a non search engine friendly 302 temporary redirect.
A 301 redirect is a search engine safe way redirecting traffic.
In PHP
This PHP code must appear before any output is sent to the browser.
****************************************************************
if(preg_match("/[index.php]$/",$_SERVER[REQUEST_URI]))
{
$url="http://".$_SERVER[HTTP_HOST].preg_replace("/(index.php)$/","",$_SERVER[REQUEST_URI]);
$sapi=php_sapi_name();
if (PHP_VERSION >= '4.3.0')
{
header("Location: $url", 0, 301);
}
else if ($sapi == 'cgi' OR $sapi == 'cgi-fcgi')
{
header("Location: $url");
// Call the status header after Location so we are sure to wipe out the 302 header sent by PHP
header('Status: 301 Moved Permanently');
}
else
{
header("Location: $url");
header('HTTP/1.1 301 Moved Permanently');
}
}
Može malo pomoći i smjernice oko tih postavki ... puno hvala
ln