iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-20-2007, 03:51 PM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,661
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default mod_rewrite not rewriting

On my site, I use mod_rewrite to convert urls so they show a more logical structure to the site. I was recently advised to change the URL for one of my catalog pages from "/items.php?section=code&maker=othercode" to "/items/code/othercode/keyword1/keyword2.php"

The mod_rewrite commands I entered were:
RewriteCond ${REQUEST_URI} ^/items/.*/.*/.*/.*.php
RewriteRule ^/items/(.*)/(.*)/(.*)/(.*).php /items.php?section=$1&maker=$2

I also tried it without wildcards, to try to match specific codes:
RewriteCond ${REQUEST_URI} ^/items/423100/607/keyword/keyword2.php
RewriteRule ^/items/423100/607/keyword/keyword.php items.php?section=423100&maker=607

In each case, I just get 404 not found errors. Mod_rewrite is enabled, and does work for several other parts of the site. Any suggestions or help would be greatly appreciated.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #2 (permalink)  
Old 04-20-2007, 05:00 PM
WebProWorld MVP
WebProWorld MVP
 
Join Date: Jul 2004
Location: Omaha
Posts: 2,714
brian.mark RepRank 3brian.mark RepRank 3
Default

Assuming you also had RewriteEngine On as the first line, the rest of this post is for further troubleshooting.

The second part of the line needs to be absolute, with the full domain included.

In other words, /items.php?section=$1&maker=$2 needs to have your domain added to the beginning with the http://.

Also, I normally add the [L] flag to the end.

Code:
RewriteCond ${REQUEST_URI} ^/items/.*/.*/.*/.*.php
RewriteRule ^/items/(.*)/(.*)/(.*)/(.*).php http://www.mysite.com/items.php?section=$1&maker=$2 [L]
Also, the RewriteCond isn't needed in this case, as your rule only applies if the requested piece begins with items.

Brian.
__________________
ToolBarn.com, an Internet Retailer Top 500 and Inc. 500 Company | Tool Parts | Pet Supplies
Reply With Quote
  #3 (permalink)  
Old 04-25-2007, 08:07 PM
WebProWorld Veteran
 
Join Date: Jun 2004
Location: Australia
Posts: 531
watto RepRank 2watto RepRank 2
Default

I am looking at doing a mod_rewrite to my site. Changing the pages from dynamic tostatic will be quite beneficial. The problem is I have no experience in this area.

Would someone be interested in working on my site for me? I am willing to pay the appropriate fees....

I appreciate all help.

Kind Regards

watto
Reply With Quote
  #4 (permalink)  
Old 04-25-2007, 08:26 PM
incrediblehelp's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jan 2004
Location: Live in Cincy Now
Posts: 7,573
incrediblehelp RepRank 4incrediblehelp RepRank 4incrediblehelp RepRank 4incrediblehelp RepRank 4incrediblehelp RepRank 4
Default

watto start a new post and post your specific needs and we can try to help you as much as can here for free!
Reply With Quote
  #5 (permalink)  
Old 04-25-2007, 08:32 PM
WebProWorld Veteran
 
Join Date: Jun 2004
Location: Australia
Posts: 531
watto RepRank 2watto RepRank 2
Default

Thanks incrediblehelp
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:40 PM.



Search Engine Optimization by vBSEO 3.3.0