php and mod rewrite for seo

Discussion in 'PHP' started by buju, Oct 19, 2007.

  1. #1
    What is the best way to improve this code for seo purposes?
    RewriteEngine on
    RewriteBase /
    RewriteRule (.*)/(.*)\.htm results.php?STATE=$1&CITY=$2

    RewriteRule ([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+) $1.php?ID=$2&STATE=$3&CITY=$4&NAME=$5[T=application/x-httpd-cgi]
     
    buju, Oct 19, 2007 IP
  2. idotcom

    idotcom Well-Known Member

    Messages:
    522
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #2
    This is what I use sometimes. Allows any filename in the address bar with a html extension to be passed as a var. I like it and works well.

    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} ^[ROOTPATH]/(.+)$ [NC]
    RewriteCond [ROOTPATH]/%1 -f [NC]
    RewriteRule .* - [L]

    RewriteRule ^(.*).html$ infopage.php?get=$1
     
    idotcom, Oct 20, 2007 IP
  3. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #3
    SEs tend to dislike directory depth. Perhaps use other symbols such as hyphens to separate items in the second rewrite rule.
     
    krt, Oct 21, 2007 IP
  4. idotcom

    idotcom Well-Known Member

    Messages:
    522
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #4
    The sample I posted would allow you to do something like

    my-product-name.html
    or
    any-words_here_like-this.html

    and that would load

    pageinfo.php?get=any-words_here_like-this
     
    idotcom, Oct 21, 2007 IP
  5. buju

    buju Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    can someone look here and tell me what i am doing wrong localfinder

    for some reason the state links wont redirect
     
    buju, Oct 28, 2007 IP
  6. idotcom

    idotcom Well-Known Member

    Messages:
    522
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #6
    Looks like you set user access. Nothing comes up.
     
    idotcom, Oct 29, 2007 IP
  7. smartcard

    smartcard Well-Known Member

    Messages:
    278
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #7
    My original URL is My .htaccess is following:
    This is producing the URL as:
    How can I produce the following URL?
    Ad you can see "Go-to-3D-model-look.html" is the name of the link
     
    smartcard, Nov 4, 2007 IP