Forum Moderators: phranque

Message Too Old, No Replies

Rewrite causing 404s

         

LionMedia

9:33 pm on Oct 7, 2010 (gmt 0)

10+ Year Member



Hi,
I recently set up some rules to rewrite dynamic links to seo friendly ones. They seem to work fine however my google crawl stats show 404s for links like this

/montgomery-county/potomac-md/

or

/montgomery-county/potomac-md/index.php

the rules I set up rewrite the links to something like this

/montgomery-county/potomac-md/detached-homes-for-sale-page1.html

What am I missing? I don't want google to try to find and index these "subdirectories". What am I missing? Here is one of my rules.

Rewriterule ^([^-/]+(-[^-/]+)*)-county/([^-/]+(-[^-/]+)*)-md/([^-/]+(-[^-/]+)*)-homes-for-sale-page([0-9]+)\.html$ index.php?action=searchresults&PageID=searchresultssef&County=$1&city=$3&Type=$5&ForSale=Y&cur_page=$7 [L]

jdMorgan

12:12 am on Oct 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You've apparently got the "to" and the "from" mixed up here. Some other function is "making your dynamic links into friendly ones -- most likely an "SEF" plug-in you've installed or a modification you've made to your HTML-page publishing scripts. This confusion only makes the problem *seem* worse, so that needs clearing up first. It is not this mod_rewrite code that makes your URLs 'friendly."

Rather, your rule rewrites (or "points" or "delivers") a browser or client URL request in the form
abc-county/def-md/ghi-homes-for-sale-page1.html
or
abc-def-county/ghi-jkl-md/mno-pqr-homes-for-sale-page234.html
to the script at a server filepath of /index.php, passing along a query string of
action=searchresults&pageID=searchresultssef&County=abc&city=def&Type=ghi&ForSale=Y&cur_page=1
or
action=searchresults&pageID=searchresultssef&County=abc-def&city=ghi-jkl&Type=mno-pqr&ForSale=Y&cur_page=234
respectively.

However, it does nothing whatsoever with the URLs for which you state that Web clients are seeing a 404, because those URLs contain no "house type" or "page number", and the "house type" plus "-homes-for-sale" and the "page number" are required by your rule.

So, you either need to add new rules that handle URLs when these parameters are not present in the requested "friendly" URL, or you need to post your existing rule for that purpose here, so it can be diagnosed.

Jim