The Web Journal aka Weblog or blog of Jere Matlock
top left corner

quotes | stories | poetry | contact | links

Follow Me!jere matlock subscribe button

top right corner


You've found the blog of Jere Matlock, a web designer and writer. This journal is mostly about writing, web design and getting sites to the top of the search engines (SEO is my business). It is also full of opinions and observations about pretty much everything. If these things are not of interest to you, feel free to go now. Go on, shoo!

Still here? If you have something to say, post a comment or send me an email.

By the way, if you feel like taking offense at something posted on this site, go right ahead, it won't bother me a bit. Kingsley Amis has a nice quote about that, in which I take solace and some pride when the flames arrive:

"If you can't annoy somebody, there's little point in writing."

| Decrease font size for Post - Using .htaccess to make search engine-friendly URLs – “There is no spoon” - Search Engine Optimization - JMBlog | Reset to normal font size for Post - Search Engine Optimization - JMBlog - Using .htaccess to make search engine-friendly URLs – “There is no spoon” | Increase font size for Post - Using .htaccess to make search engine-friendly URLs – “There is no spoon” |

Using .htaccess to make search engine-friendly URLs – “There is no spoon”

7 Responses to “Using .htaccess to make search engine-friendly URLs – “There is no spoon””

  1. Jere Matlock Says:

    Wow thanks a lot for your reply, not used to getting feedback this fast, and such excellent one too.

    This is pretty much exactly what I was looking for. I guess any further information, for example on dynamic generation of the .htaccess files
    should be available via google.

    Thanks again,

    -Jan

  2. Jim Gaudet Says:

    Thanks for the info, but I have a different question more database related. I would like to have the url like this;

    domain.com/products/category/product-title

    category and product-title with be tables in the database. How can I get it to search the database for the proper category and product?

    How could I get the .htaccess file to forward the variables to the PHP page,which can search for the category and product-title, then generate the page?

    Thanks in advance,

    Jim

  3. Jere Matlock Says:

    If you want to have your website using page names something like this:

    http://www.hubcaps.com/dodge/66-valiant-hubcaps

    that’s fairly easy to set up using a RewriteRule in .htaccess

    RewriteEngine On
    RewriteRule ^dodge/66-valiant.php /display.php?category=dodge&year=66&model=valiant [L]

  4. Mark Says:

    This is great. Thank you.

    It obviously allows people to get routed to the right part of your database but how does a search engine know what to look for? Does it spider the .htaccess file?

  5. Jere Matlock Says:

    No – Google never sees the .htaccess file (it’s inaccessible through normal browsing).

    Instead, when Google requests the page, in much the same fashion as a person browsing the page would request it, the server creates it “on the fly” and gives it to Google based on the action of Google requesting the page. It’s fast and it works. This is how to show elegant, search-engine-friendly URLs while having the actual content come from a database by using question marks, product ids, category ids, and so on. In practice, it works great!

  6. abbas Says:

    hi
    i have any dynamic page like this in my site:
    http://mirsoft.net/detail.php?siteid=433

    how can i change to this : http://mirsoft.net/detail-433.html by .htaccess file.

    thanks.

  7. Jere Matlock Says:

    Hi, Abbas -

    Test this code in your .htaccess file, to see if it works:

    RewriteEngine On
    RewriteRule ^detail-433.htm /detail.php?siteid=433 [L]

    —————-

    Here are some tutorials on using .htaccess that you may find useful:

    http://softexpert.wordpress.com/2007/10/15/learn-htaccess-in-10-minutes/

    http://www.thejackol.com/htaccess-cheatsheet/

    http://www.javascriptkit.com/howto/htaccess.shtml

    Good luck!

    Best,

    Jere Matlock

Leave a Reply

bottom left corner bottom line bottom right corner