.htaccessseofriendly-urldynamic-pages

Rewriting a URL


I developed my website so that all pages are loaded dynamically on 1 page by ajax, and so that the URL will appear in this format:

www.website.com/#home
www.website.com/#news
www.website.com/#news-details/news-title-goes-here

I discovered later-on that my pages aren't appearing in search engines and Google bots won't visit me this way. So what's the easiest way to fix it and convert URL into this form:

www.website.com/news/news-title-goes-here

Could it be done with just modifying .htaccess ?


Solution

  • I followed this link:

    https://developers.google.com/webmasters/ajax-crawling/ 
    

    Converted all my dynamic pages to appear in this way:

    www.website.com/#!home
    www.website.com/#!news
    www.website.com/#!news-details/news-title-goes-here
    

    (added the ! after the Hash)

    Then generated Html snapshots dynamicly. (however I made them in only 1 file html-snapshot.php) So now I had 2 types of URL:

    the Ugly one:

    www.website.com/html-snapshot.php?_escaped_fragment_=news-details/news-title-goes-here
    

    and the pretty one:

    www.website.com/#!news-details/news-title-goes-here
    

    I added all the pretty URLs into a sitemap and submitted in Google Webmaster, and Fetched all the Ugly ones in the webmaster tools "Fetch as Google"

    and in summary that's it, Google is now seeing all my ajax pages.