Wordpress htaccess issue for SEO product page

Discussion in 'WordPress' started by itliberty, Nov 20, 2009.

  1. #1
    Looked all over cant find an answer.

    Within wordpress I have a page that goes to a page like this
    domain.com/folder/folder2/?product=Product+Name

    and I want it to show
    domain.com/folder/folder2/Product-Name/

    I think the default htaccess file is preventing some of the normal ways of doing this. Any suggestions on how I get this done?

    Thanks!!!
     
    itliberty, Nov 20, 2009 IP
  2. bob25

    bob25 Well-Known Member

    Messages:
    1,519
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    128
    #2
    Go to Settings/Permalinks

    Select Custom Structure and paste /%category%/%postname%/
     
    bob25, Nov 20, 2009 IP
  3. aping

    aping Peon

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah, it works. I use this settings to my blog, too. :cool:
     
    aping, Nov 21, 2009 IP
  4. itliberty

    itliberty Peon

    Messages:
    1,173
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank you for the reply but this is not a noobie question. I too use this config you mention, but that is not the issue. The page is a WP "page" and in it is code that has an embedded store. The store requires a ?product=Product+name in order to search the store (via php code).

    So the /%category%/%postname%/ gets me to the URL, domain.com/category/postname (domain.com/store/clothing-page/) but after that it is something additional.

    When I put in a rewrite in addition to the WP htaccess file used for /%category%/%postname%/ it doesnt seem to take. I imagine because something is taking precedence over my newly inserted rule.

    Does this help explain it?
     
    itliberty, Nov 21, 2009 IP
  5. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #5
    You can't do that because of this line.

    RewriteRule . /index.php [L]
    Code (markup):
    Basically it forwards all request to index.php.
     
    ads2help, Nov 21, 2009 IP
  6. itliberty

    itliberty Peon

    Messages:
    1,173
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Make no mistake about it that it can be done. I just havent had as much experience with htaccess to do it.

    The line you mention does do in fact that (forward all requests to index.php) but on the conditions before it (the two rewrite conditions for those that don't know are the wordpress magic sauce - it says for anything that isnt a real file or a real directory, do whatever - in this case forward to index.php for processing)

    So I think the answer lies in defining this instance as a rewritecond, but then I need help in processing it the way that I want it which might be something like /store/clothing-page/ goes to index.php?however-worpress-does-this&product=Product-name

    The other solution I have seen work is to take that page out of wordpress and make it a static page (then the conditions as I describe them don't apply because it is a real file and real directory) and my normal htaccess rule will work. I would then just need to create a page to match the template which wouldn't be all bad except to work through building in so it requires minimum maintanence when headers and sidebars are updated.

    I am just not proficient in it enough to think it through which is why I was asking for help. Understand this - there will be an answer at the bottom of this thread, it might just be from me ;) Thanks again.
     
    itliberty, Nov 22, 2009 IP
  7. itliberty

    itliberty Peon

    Messages:
    1,173
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I wanted to follow up for those that do believe!

    I have found a way and have accomplished it. There is actually something someone started writing. I must have searched 20 different things and went 10-20 pages deep in Google to find something, but it has been done.

    I will say this, wordpress does in fact replicate the functions of htaccess so nothing you can put into htaccess will change the behavior. So you need to add rewrite rules into wordpress to get the functionality.

    Take care all, but there are answers out there, dont give up!
     
    itliberty, Nov 24, 2009 IP