Mod rewrite - question

Discussion in 'Apache' started by tatjana, Mar 17, 2006.

  1. #1
    Hello all,

    Compliments for the great forum. Although its my first post it has helped me a lot in the past!

    I have a little problem here.
    These are some of my dynamic urls:
    http://www.mysite/companysearch/search_result.php?search=Browse&category=painter
    http://www.mysite/companysearch/search_result.php?search=Browse&category=builder


    Thats not excactly the urls search engines like!

    I would love to change it into:
    http://www.mysite/companysearch/painter.html
    http://www.mysite/companysearch/builder.html

    Can somebody help me on this one?
    Thnx Tatjana
     
    tatjana, Mar 17, 2006 IP
  2. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #2
    just-4-teens, Mar 17, 2006 IP
  3. tatjana

    tatjana Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thnx for your reply.

    Its not excactly the rewrite i was looking for. It must be possible i quess to make a rewrite for my examples. So without the "search_result" and the browse

    Thnx again
     
    tatjana, Mar 18, 2006 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    domain.com/.htaccess

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^companysearch/([^.]+)\.html$ companysearch/search_result.php?search=Browse&category=$1 [L]
     
    Nintendo, Mar 18, 2006 IP
  5. tatjana

    tatjana Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thnx Nintendo,
    I think thats what im looking for! But...
    It still doesnt work.
    I already have a htaccess file in my root for some permanent redirects. Perhaps thats giving some troubles.

    Do i have to put this htaccess file in my root folder or in the folder
    http://www.mysite/companysearch

    Perhaps i can send u the site so u can see what i mean?

    Greetz tatjana
     
    tatjana, Mar 18, 2006 IP
  6. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #6
    That code is for domain.com/.htaccess Post your current .htaccess file

    If you want it at domain.com/companysearch/.htaccess...

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /companysearch/
    RewriteRule ^([^.]+)\.html$ search_result.php?search=Browse&category=$1 [L]

    What's the domain name?
     
    Nintendo, Mar 18, 2006 IP
  7. tatjana

    tatjana Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    see personal message ;)
     
    tatjana, Mar 18, 2006 IP
  8. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #8
    Yikes!! LONG .htaccess file!!!

    Try that .htaccess code in the companysearch/ directory in the last post. Search robots don't use search engines, so they won't even see the links unless you have HTML links pointing to those pages some where.

    And it won't change the links. The script would have to be changed to point to the new URLs.
     
    Nintendo, Mar 18, 2006 IP