htaccess seo url issue

1 replies
I have a web page that is passing variables to a content display page. For example:

Page 1 has this link:

Code:
<a href="http://x.com/car.php?year=1959&make=chevy&model=corvette">1959 Chevy Corvette</a>
so the page car.php displays info about that particular car.

But instead of the url being:

Code:
x.com/car.php?year=1959&make=chevy&model=corvette
I want the browser url to instead show this (for seo and it just looks better):

Code:
x.com/1959-chevy-corvette.html
I have used various .htaccess codes and nothing is changing the browser url. Here is my .htaccess code:

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)-(.*)-(.*).html$ car.php?year=$1&make=$2&model=$3
Thanks. I got it figured out.
#htaccess #issue #seo #url
  • Profile picture of the author Jerry Jackson
    Hey kindsvater,

    I think your "(.*)" condition is matching the "-" aswell, perhaps try an exclusion set to capture the value instead as follows:

    RewriteRule ^([^\-]+)-([^\-]+)-([^\-]+)\.html$ car.php?year=$1&make=$2&model=$3

    [^\-] will include all characters except the dash
    That's just a guess but I'll run a test here when I get a minute
    {{ DiscussionBoard.errors[3755735].message }}

Trending Topics