HTTP 301 Redirects med php

For at teste hvilken type redirect en given side laver:

@ telnet localhost 80
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
GET / HTTP/1.1
Host: lcauto.dk

HTTP/1.1 302 Found
Date: Sat, 23 Aug 2008 23:33:49 GMT
Server: Apache/2.2.3 (Debian) PHP/4.4.4-8+etch6 proxy_html/2.5
X-Powered-By: PHP/5.2.0-8+etch11
location: http://www.lc-auto.dk/
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1

Connection closed by foreign host.

for at lave den rigtigt:

<?
Header( “HTTP/1.1 301 Moved Permanently” );
header(‘location: http://www.lc-auto.dk/’);
?>

skal vi nu vaere helt sikker paa at fange alt kan vi lave flg. htaccess fil:

RewriteEngine on
RewriteBase /

RewriteRule ^(.*)$/? index.php [L]

Dette indlæg blev udgivet i Knowledge Base, Networking, Old Base. Bogmærk permalinket.

Skriv et svar