Hi, Farzan

Redirecting is something you can do in a way the user doesn't see anything
(I call them server-side redirects) and in a way the user get's informed
that the url has changed (I call them client-side redirects).

What I mean with server-side (mostly called internal redirects) is if the
user requests a page, you can do stuff with mod_rewrite (in Apache) or some
equal webserver-module to call another file than requested. The user will
not get any notice about that.

Client-side redirects can be done using the HTTP-header (see
JavaScript (please think also about a non-js solution) and by using a HTML-Meta
tag <http://en.wikipedia.org/wiki/Meta_refresh>.
In my opinion the best way to do a redirect, where the user gets noticed
about, is the HTTP-header. This can be set f.e by your webserver or by a

Example for PHP-script:

header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: http://www.new-url.com"; );

As far as I know, this is the only way to let other services (f.e. a
search-engine) know that this page has been moved permanently (or
temporarily) to another url.
That's the reason why I use the header-command (incl. setting the
HTTP-Status explicitly). If you don't set the HTTP-header, it will be added
(by PHP or your webserver). In my case, I use PHP 5.4 and nginx 1.2.1, the
header-code 302 is added if I don't set it.

May there are more ways to set redirects, but this are the one I know of.


On Sun, Jun 17, 2012 at 10:06 AM, Farzan Dalaee <farzan.dal...@gmail.com>wrote:

> hi guys
> is there any way to reload page without using header('location
> :index.php'); and javascript?
> Best Regards
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to