If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > Mod Rewrite 301 Help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-06-11, 06:16
cesarcesar cesarcesar is offline
Registered User
 
Join Date: Mar 2008
Posts: 55
Mod Rewrite 301 Help

I need to 301 some links. I have been getting my knees wet with ModRewrite for a while now, but this one seems to throw me. The format I'm looking for is below.

Old - http://www.sitename.com/big-widget/blue/2.html

New - http://www.sitename/blue-big-widgets/2.html

Two thinks to note, I have added a (s) to the end of widgets. As well as the 2.html will be any number between 1-100 depending on the page.

Thanks for your help in figuring this out.
Reply With Quote
  #2 (permalink)  
Old 05-09-11, 04:55
cesarcesar cesarcesar is offline
Registered User
 
Join Date: Mar 2008
Posts: 55
The solution I ended up going with was

Code:
RewriteRule ^(big-widget)/([^/\.]+)/(.*) $2-$1es/$3 [R=301,L]
A more dynamic version is

Code:
RewriteRule ^([^/\.]+)/([^/\.]+)/(.*) $2-$1es/$3 [R=301,L]
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On