Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Other Web Development Languages (http://www.programmingforums.org/forum40.html)
-   -   Apache Mod Rewrite Help (http://www.programmingforums.org/showthread.php?t=9135)

Makaveli19 Mar 30th, 2006 9:48 PM

Apache Mod Rewrite Help
 
Hello,

I was hoping somebody can help me. This 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 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

BeachBum Apr 19th, 2006 1:29 AM

Writing the ModRewrite rules is the easy part, you would use something like:
RewriteRule ^/.*/[^/]+\_([0-9]+).html+$ index.php?a=1002&b=$1

the rules are ignoring the "Category" part of the string anyway. The more difficult task would be getting the site to leave the "Category" off of every URL string.

For SEO purposes this is a good idea as spiders will find the page closer to the root and therefore expect it to be of higher value.

-Travis
http://www.bestcodingpractices.com


All times are GMT -5. The time now is 10:50 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC