Forum Moderators: phranque

Message Too Old, No Replies

Permanent Redirect and adress-bar update?

How to get the adressbar to change as well?

         

pmkpmk

9:16 am on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I recently updated my site structure and did permanent redirects for all pages. So www.mydomain.com/jobs.html has now become www.mydomain.com/en/job_offerings.html

The redirect works - the visitor comes to the correct page. However the browsers address-bar still shows www.mydomain.com/jobs.html instead of the new URL.

The problem becomes even more annoying because I also moved a complete domain which had the content mirrored to the original domain to avaid SE penalties due to duplicate content. So I redirected www.domain1.com -> www.domain2.com

But if a visitor surfs to www.domain1.com/en/jobs.html the browser address bar does NOT reflect the new URL and he can still move in the context of domain1 - even if he clicks through to other pages.

My redirect statements look like these:

In httpd.conf:


<VirtualHost 1.2.3.4>
ServerName www.domain1.com
RedirectPermanent / http://www.domain2.com/
</VirtualHost>

and for the single page redirects in .htaccess:


RedirectPermanent /jobs.html http://www.mydomain.com/en/job_offerings.html

Any help?

lemat

10:35 am on Apr 14, 2004 (gmt 0)

10+ Year Member



try mod_rewrite with [R]

for eg.
RewriteRule (.*) en/$1 [R]

but I belive it's the browser's problem
try to telnet to your_host:80

GET /jobs.html HTTP/1.1
Host: www.mydomain.com
Connection: close [2xEnter]

and see what happens

apache should give you 301 or 302 Moved and the path where this document is moved.

pmkpmk

12:15 pm on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



apache should give you 301 or 302 Moved and the path where this document is moved.

No, the document is served.

Well... me might have a problem here. I tried another URL and get this:


HTTP/1.1 301 Moved Permanently
Date: Wed, 14 Apr 2004 12:16:27 GMT
Server: Apache/1.3.xx
Location: http://www.mydomain.com/en/job_offerings.html

Argll....... Mix up of two things!

Actually the OLD address was www.mydomain.com/html/jobs.html - this one get's mapped correctly to the new one AND the address bar updates! (Second example)

But then, if you use only www.mydomain.com/jobs.html my CMS(!) picks this up, and looks for the MOST APPROPRIATE page to deliver! (First example)

So this is solved...

What remains is that even though domain1.com is redirected to domain2.com, the adress bar does NOT change to domain2.com.

Any hints?

pmkpmk

1:27 pm on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's not my lucky day. I spent hours of tweaking htaccess and http.conf until I realized I was working on the wrong server :-(

Now it works like this:


<VirtualHost 1.2.3.4>
ServerName www.domain2.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain1\.com
RewriteRule (.*) http://www.domain2.com$1 [R=301,L]
</VirtualHost>

Thanks anyways...