Mod Rewrite Problem

Discussion in 'Apache' started by Makaveli19, Mar 30, 2006.

  1. #1
    Hello,

    I was hoping somebody can help me. Below is a mod rewrite for my auction site. It works great, however I was wondering if it's possible to remove the "Category/" part before each url.

    With the mod rewrite the urls currently look like this http://www.mysite.com/Category/Cell_Phones/

    I was just hoping there is a way to remove the "Category" part of the url so that the urls would read like this http://www.mysite.com/Cell_Phones/

    Is this possible with the rule below? I have tried but was unsuccessful. I got it to the point where everything was working except the CSS and images weren't appearing. Can someone help? Thanks in advance!

    # Browse auction
    RewriteRule ^Category/.*/[^/]+\_([0-9]+).html+$ index.php?a=1002&b=$1

    # Browse auctions by category
    RewriteRule ^Category/([^/]+/?[^/]+)/$ index.php?a=1005&b=$1&c=
    RewriteRule ^Category/([^/]+/?[^/]+)/\?Browse=([^&]+)$ index.php?a=1005&b=$1&c=$2
    RewriteRule ^Category/.*((images|css)/[^.]+\.[a-z]+)$ $1
    RewriteRule ^Category/.*/([^/]+\.[a-z]+)$ $1
     
    Makaveli19, Mar 30, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    You can only do it if the site is 100% using your index.php script.

    And then you have to change the CSS and image codes so there as if those URLs were the real URLs.
     
    Nintendo, Mar 30, 2006 IP
  3. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It should work fine if you remove the Category/ part (including the slash) from all the rules *and* modify the script that creates the URLs to eliminate the Category/ part there as well. I'm not sure why your images/css doesn't show. What script are you using?
     
    exam, Mar 30, 2006 IP
  4. Makaveli19

    Makaveli19 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hey Guys,

    Thanks for the responses. The script I am using is this one;

    geodesicsolutions.com/products/auctions/demos/enterprise/index.php

    I did try to remove the Category/ part and when I did that it seemed to work but like I said the css and images weren't working. If I remove the Category/ part from the .htaccess some lines would go from;

    RewriteRule ^Category/.*((images|css)/[^.]+\.[a-z]+)$ $1 to
    RewriteRule ^.*((images|css)/[^.]+\.[a-z]+)$ $1

    I think part of the problem is the rule now starts with ".*" This may be causing the problem. Can this rule start with that? If not what is the proper programming?

    I really appreciate any help I can get.
     
    Makaveli19, Mar 31, 2006 IP