Forum Moderators: phranque
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^CraftCategory_(.*) /search_result.php?search=Browse&category=$1 [nc]
Also... If I put ../CraftCategory_Candles/ (with following slash) my css doesn't show up and the page looks awkward. Is there an explanation for this? And if so is there a solution? I understand that the page is probably looking for the .css in it's own folder, but there is no such folder as /CraftCategory_Candles/
Sorry I'm pretty new to this~! but lovin it so far!
ThX For your help in advance!
If you do not want this information (11111) /CraftCategory_Candles11111 to be passed, you can use a different regular expression:
RewriteRule ^CraftCategory_([a-z]+)$ /search_result.php?search=Browse&category=$1 [NC,L]
The problem I see with your css is this '../'. This is a 'directory relative' link and will start from where you are and move forward. /full/path/to/the/css.css file (No ..) is server relative, and will always start at the root and move forward to the directory. I usually use server relative, and if not, I use a full canonical URL http://www.mysite.com.
I serve a fairly large directory using php, SQL and mod_rewrite... I have found the best way to links is one of the two I have highlited. There are those who would argue page site, and link text from a SE and load speed POV (believing they are impacted by the added characters), but I like to make sure my users receive the pages and information the way I intended, so I use a few more characters and make sure that happens.
I made a couple more adjustments to your rule, that you may want to implement even if you do not change the regular expression:
1. Added $ as a true 'ending' to the left side of your rule.
2. Added L to your directives to designate 'last' or stop processing now. This should alwzys be used, unless you absolutely know you should not.
Hope this helps.
Justin
Oops! Forgot...
RewriteRule ^CraftCategory_([a-z]+)/?$ /search_result.php?search=Browse&category=$1 [NC,L]
Adding the /? will make a trailing / optional, and not include it in the information served... The only thing you have to make sure of is that you do not link to it, or it may cause duplicte issues. You can add another rule that will fix that, but I have to run, so if you have questions about how to make that work, let us know and I or someone else can get back to you with some details.
Thanks for the extensive reply! I tried your RewriteRule but got a problem. Some of my Category names were two or three words. Using the ([a-z]+)$ restricted it to letters only? Is there a way to get past this? As for the CSS not working, I went into my search_result.php and editted so that it was a "canonical URL" (big word) =)
Now that my categories look like this:
www.mysite.com/CraftCategory-Baskets
Would it be better with a slash at the end?
www.mysite.com/CraftCategory-Baskets/
My next step would be after entering the CraftCategory-Baskets, I get my directory listing. Each pointing towards a more detailed listing.
[mysite.com...]
The ckey=53 is sorta boring... I could make it www.mysite.com/CraftCategory-Baskets/Listing-53/
But would this make a big difference as to SEO wise?
Any possibility I could take a look at your directory? PM me? I read up more on your website and it was very useful!
Oh yeah one more quick question =) some people think that there is a penalty for double information/pages? If i were to exclude for example search_results.php using robots.txt would this affect my newly directed categories (www.mysite.com/CraftCategory-Baskets/)?
and another... haha just popped into mind for my categories with spaces ie... Latch Hook The URL is showing Latch+Hook/ is there any way to turn that + into a -?
Thanks again!