homepage Welcome to WebmasterWorld Guest from 54.227.171.163
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Redirecting old pages to new PHP default page
Old files do not exist
hexdj

5+ Year Member



 
Msg#: 4677 posted 5:38 am on Sep 21, 2005 (gmt 0)


Hi guys, I just finished implementing PHP on my site and I only use index.php with file ids on my new site (index.php?id=10) the thing is search engines have already spidered old pages like welcome.htm which I deleted from my server now.

I am not sure this is actually a PHP question but I would like to know how to redirect all non-existing pages or page requests to my new index.php file.

 

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4677 posted 4:25 pm on Sep 21, 2005 (gmt 0)

is it on Apache?

hexdj

5+ Year Member



 
Msg#: 4677 posted 5:42 pm on Sep 21, 2005 (gmt 0)

_SERVER["SERVER_SOFTWARE"]Apache/1.3.26 (Unix) FrontPage/5.0.2.2623

I believe it is

hexdj

5+ Year Member



 
Msg#: 4677 posted 12:45 am on Sep 22, 2005 (gmt 0)

Any changes on .htaccess maybe?

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4677 posted 4:14 am on Sep 22, 2005 (gmt 0)

This thread [webmasterworld.com], read in-depth, will provide you with some information --and some critical warnings-- about what you are trying to do.

I strongly suggest you reconsider your basic approach and retain your static URLs unless your search engines rankings are of no consequence to you.

More information can be found by searching for, and reading, the many "search engine friendly URL [google.com]" threads here.

Jim

hexdj

5+ Year Member



 
Msg#: 4677 posted 4:35 pm on Sep 22, 2005 (gmt 0)

Sorry for the newbie-ness... but does that (the other post messages) mean that SE won't spider sites with my new format (i.e. index.php?id=101)?

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4677 posted 7:31 pm on Sep 22, 2005 (gmt 0)

Yes, that's what it means. Search engines don't do very well with dynamic URLs. They can handle one parameter, sometimes two. But this forum is full of threads from people asking how to use static URLs on dynamic sites to avoid the problems with search engine listings.

The procedure is:

  • Change your pages (or page-generation script) to output static URLs (like the ones you had before)
  • Use mod_rewrite to internally convert these URLs, when requested by browsers and SE spiders, to the proper form needed to invoke your script to generate the correct page.
  • Use mod_rewrite to exteranlly redirect any attempt to directly access your script to the proper static form of the URL. This optional step will correct for any dynamic URLs already listed by search engines.

    So, for "welcome.htm" you would use:

    RewriteRule welcome.html /index.php?id=10 [L]
    #
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?id=10\ HTTP/
    RewriteRule ^index\.php$ http://www.example.com/welcome.html [R=301,L]

    It should be obvious from the above that two rewriterules will be needed per page on your site. This is because your are leaving in up to mod_rewrite to "associate" the old page "welcome" with the new page "id=10". If possible, your should dump the "numerical naming" altogether, and use "id=welcome" to call your script. Then translate "welcome" to "page number 10" inside the script itself.

    You will do better in the search engines if you use meaningful URLs, instead of publishing URLs with page numbers in them.

    At any rate, I'd suggest some more research into "search engine friendly URLs [google.com]" and all the issues that surround their use. After you've decided what to do, then it will be time to implemetations.

    Jim

  • webhound

    10+ Year Member



     
    Msg#: 4677 posted 6:33 pm on Sep 23, 2005 (gmt 0)

    We have a related situation.

    We're almost done building our new website. In doing this all the pages are going from .jsp to html. So any listings that we had will come up 404 unless we do server side redirects from these old pages to the new ones.

    My question is should we bother doing redirects for pages that used to be ranking well in the search engines at all? I mean Google and MSN are pretty fast in crawling, and alot of our listings are the root domain, not all of them are specific pages.

    Is it better/worse to just let them go and wait for the site to be re-crawled?

    jdMorgan

    WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



     
    Msg#: 4677 posted 10:25 pm on Sep 24, 2005 (gmt 0)

    This is really an SEO question, but I'll take a shot at it.

    If the pages are well-linked from within your site, and not linked-to from outside your site, then it may not be necessary to redirect them. Otherwise, you'll probably want to redirect for the sake of keeping the traffic.

    Jim

    Global Options:
     top home search open messages active posts  
     

    Home / Forums Index / Code, Content, and Presentation / Apache Web Server
    rss feed

    All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
    Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
    WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
    © Webmaster World 1996-2014 all rights reserved