Подскажите как сделать правильно редирект

L
На сайте с 17.05.2013
Offline
88
259

Сейчас реализовано так:

если не нашло страницу в базе

{

header('HTTP/1.1 301 Moved Permanently');

header("Location: http://site.com/404.html");

}

В htaccess пишет:

ErrorDocument 404 /404.html

RewriteRule ^404.html 404.php [QSA]

Такая проблема: если ввожу неправильный адрес, то грузится нужная страница 404.php, но в браузере все-равно пишет неправильный адрес, тоесть какбы редирект но не до конца.. Посдкажите почему? Ведь в браузере должно оставаться site.com/404.html

siv1987
На сайте с 02.04.2009
Offline
427
#1
luckydan:
ErrorDocument 404 /404.html

http://httpd.apache.org/docs/2.2/mod/core.html#errordocument

Note that when you specify an ErrorDocument that points to a remote URL (ie. anything with a method such as http in front of it), Apache will send a redirect to the client to tell it where to find the document, even if the document ends up being on the same server.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий