Forum Moderators: phranque

Message Too Old, No Replies

The URL in the Browser does not change when using redirect.

browser redirect url

         

bfayez

8:04 am on Jun 11, 2005 (gmt 0)

10+ Year Member



I set a redirect into my http.conf as follow:
RewriteEngine On
Redirect /index.php http://www.example.com/pls/htmldb/f?p=101:1 [R=302]

The redirect works file but the URL in the browser does not change to http://www.example.com/pls/htmldb/f?p=101:1 but it will stay as http://www.example.com

I even tried to use PHP to do the redirect but I get exactly the same result. So I am assuming that there is something wrong with my Apache setup. What should I need to do so that the redirect will cause the browser url to change to the redirected url.

[edited by: jdMorgan at 9:16 pm (utc) on June 12, 2005]
[edit reason] Example.com [/edit]

Dijkgraaf

10:54 am on Jun 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want the URL to change you have to use 301 redirect, not a 302 redirect, and possibly in the .htacess, that is where I do mine and that works fine :-)

jdMorgan

2:24 pm on Jun 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Either a 301 or 302 should update the browser address bar. The rewrite can be done in either httpd.conf or .htaccess.

It's possible that your rule is not being invoked. Try redirecting to a page that does not exist. If the rewrite rule is working you should get an error.

Check for mod_rewrite dependencies: AllowOverride FileInfo Options at minimum, and Options FollowSymLinks must be enabled.

If on Apache 1.x, mod_rewrite must follow any other modules that you wish to invoke for that filetype in the LoadModule list. If you modify the order of this list, keep a backup!

Jim

bfayez

2:31 am on Jun 12, 2005 (gmt 0)

10+ Year Member



I found out what could be causing the problem. When I check the source of the page I see there is a Frameset which probably causing the redirection problem. But the odd thing is I do not have a Frameset in my html page. In other word, when I request www.mysite.com it will get redirected to new url but when I check the page source using FireFox I get a page with a Frameset refering to the URL. What could be causing this?

jdMorgan

9:20 pm on Jun 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you have a straighforward domain registration with DNS records that you control, or are you using one of those "domain forwarding" services. If you care about such things as controlling redirects and search engine ranking, then use a regular registered domain and dump the forwarding service.

These services are famous for offering two bad solutions; They either frame your page or use a 302-redirect, and both of those are deadly for search engine ranking.

Jim

[edit] Speling corekshun [/edit]

[edited by: jdMorgan at 5:18 am (utc) on June 13, 2005]

bfayez

4:34 am on Jun 13, 2005 (gmt 0)

10+ Year Member



This is exactly what the problem is and they sent me a script to insert in the index.html to handle this issure but will stop using them as soon as I can.

Thanks for your help.

g1smd

9:02 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Avoid the 302 redirect. Use a 301.

Look in the Google forum, at posts a month or more old, for why 302 is bad bews.