iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-17-2008, 07:07 AM
WebProWorld New Member
 
Join Date: Feb 2007
Location: Pune
Posts: 16
pankaj.sharma RepRank 0
Default Problem in redirecting URL

I want to redirect http://www.mojopages.com/biz//san-di...92101/18490213 to
http://www.mojopages.com/biz/san-die...92101/18490213

can anyone suggest how can i do this.
Reply With Quote
  #2 (permalink)  
Old 03-17-2008, 07:15 AM
chandrika's Avatar
WebProWorld Veteran
 
Join Date: Oct 2005
Location: Cambridge, UK
Posts: 376
chandrika RepRank 4chandrika RepRank 4chandrika RepRank 4chandrika RepRank 4
Default Re: Problem in redirecting URL

If its permanently moved, on the old page just put this code

Code:
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.urlofnewpage.com" );
?>
That is how I have done it on my site, so will be interested to hear if there is any problem with that.
__________________
2009 Hairstyles - Pictures of 2009 hairstyles and a virtual hairstyler demo.
Price Comparison Site - Compare prices of well known brands and products.
Reply With Quote
  #3 (permalink)  
Old 03-17-2008, 04:41 PM
WebProWorld Pro
 
Join Date: Sep 2005
Location: Manchester, UK
Posts: 254
mikesmith76 RepRank 0
Default Re: Problem in redirecting URL

chandrik's method works fine. Only suggestion i would make though is if possible put all your redirects in an .htaccess file. Much neater, saves having a load of php files whose sole purpose is to redirect an url.
Reply With Quote
  #4 (permalink)  
Old 03-18-2008, 11:17 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,651
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: Problem in redirecting URL

If you do not have the ability to set redirects with .htaccess, and your site uses PHP, Chandrika's method would be adequate, although I would suggest two changes to the code:
PHP Code:
<?php
header
('Location: http://www.newurl.com',301);
exit();
?>
This should use lower overhead, and be more resistant to errors. By default, using header('Location') uses a 302 redirect, and some versions of PHP do not use the previously specified HTTP line correctly, so specifying the redirect code in the location line avoids this possible bug. Using the exit() function saves some processing by preventing any further code in the script from being processed, since it will not be visible to the user anyway.

If you have access to htaccess, I would strongly recommend using an explicit redirection:

Code:
# Change oldurl.com/oldpage.html to oldurl.com/newpage.html
Redirect 301 /oldpage.html http://oldurl.com/newpage.html
# Change oldurl.com/oldfolder/page.html to oldurl.com/newfolder/page.html
RedirectMatch 301 ^/oldfolder/(.*)$ http://oldurl.com/newfolder/$1
This method requires the least processing, and will work with any type of file, including images.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #5 (permalink)  
Old 03-22-2008, 03:20 AM
WebProWorld Member
 
Join Date: Mar 2008
Posts: 42
califmerchant RepRank 0
Default Re: Problem in redirecting URL

<script type="text/javascript">
window.location = "URL"
</script>


this works too
Reply With Quote
  #6 (permalink)  
Old 03-24-2008, 10:56 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,651
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: Problem in redirecting URL

Quote:
Originally Posted by califmerchant View Post
<script type="text/javascript">
window.location = "URL"
</script>


this works too
This would work, however search engines are likely to see this as potentially spammy, and would not follow the redirect. In addition, certain Internet security applications may prevent the redirection or, worse, display a security alert to the user.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #7 (permalink)  
Old 03-24-2008, 12:32 PM
WebProWorld Veteran
 
Join Date: Jul 2004
Posts: 913
activeco RepRank 2
Default Re: Problem in redirecting URL

Pankaj.sharma, do you refer to double slash?
__________________
Impossible? You just underestimate the time.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
301 redirect not redirecting thebloke Search Engine Optimization Forum 16 11-29-2006 08:36 AM
Redirecting URL tushar123 Search Engine Optimization Forum 0 11-09-2006 04:12 AM
Problem in redirecting dynamic page to static one ! Pls HELP ashishdabas Search Engine Optimization Forum 2 09-11-2006 05:37 PM
MSN.com redirecting to MSN.co.uk dburdon MSN Search Discussion Forum 4 05-04-2006 10:00 AM
Redirecting without effecting PR icb01co2 Google Discussion Forum 4 06-11-2004 08:10 AM


All times are GMT -4. The time now is 02:44 AM.



Search Engine Optimization by vBSEO 3.3.0