views:

12

answers:

1

How to redirect existing url to new url?

Sample : I have www.a.com/help.php

in google/yahoo : when visitor click this link "www.a.com/help.php" on address bar automatically change be www.a.com/help.

Because in .htaccess I was rewrite www.a.com/help and this condiction is success.

The problem is how to change automatically on address bar www.a.com/help.php --> www.a.com/help

Using .htaccess or other tricks?

Thanks.

A: 

You could use

<?php
header("Location: http://www.a.com/help");

That should change the addressbar.

With .htaccess you could try

redirect 301 /help.php /help

Here you can read more on htaccess redirect

David Mårtensson
in .htaccess RewriteRule ^help help.php [QSA,L],if I using header(), its syntax always looping..
Abel
redirect 301 /help.php /help not working...
Abel
Is help the same page as help.php, then you have to check which url the page got called with before the header solution to prevent looping. With htaccess, I cannot help you more as I have only done a few rewrites myself and only tried to give you directions to a page with more info.
David Mårtensson