Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 06-01-2011, 05:50 PM
Junior Member
 
Join Date: 06-01-11
Posts: 1
iTrader: 0 / 0%
htaccess and image dir redirection - Magento

Hi everyone,
Total noob here with pretty limited coding experience, so please bear with me!

We're in the process of switching our e-commerce software after using the same system for over 5 years. As such, the directories for our images will drastically change - and any images registered with search engines will eventually stop working. Thus, we require a bit of code that will redirect our old image directories.

Here's where it gets a bit more complicated. The new software (Magento) creates directories that reference the first and second letters (case-sensitive) of the image. For example, if you uploaded grayfox.jpg, Magento would do the following:

http://www.mysite.com/mag/media/catalog/product/g/r/grayfox.jpg
- note the /g/r/ directories

Using the same example, we would need a redirect of the following written in our htaccess file -

http://www.mysite.com/us/files/productdetails/grayfox.jpg
to
http://www.mysite.com/mag/media/catalog/product/g/r/grayfox.jpg
- where "g" dir is the first case-sensitive letter of the image filename and "r" directory is the second case-sensitive letter of the image filename

Can anyone help us with this problem? Much thanks in advance!

Last edited by HTMLBasicTutor; 06-01-2011 at 07:19 PM.
 
Reply With Quote
  #2 (permalink)  
Old 06-02-2011, 05:14 AM
nemrod's Avatar
v7n Mentor
 
Join Date: 12-21-10
Location: Sweden
Posts: 461
iTrader: 0 / 0%
I think this would be easier to do with PHP. Add code in the 404 file that detects when the visitor was trying to access a URL in "/us/files/productdetails/" and 301 them to the new URL. I might give it a go with rewriterules later.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
htaccess redirection question jonnyfolk Coding Forum 2 09-28-2009 11:11 PM
Need help with .htaccess file (www. redirection) projectwealth Domain Name Forum 4 01-09-2008 05:32 AM
Please tell me how to make 301 redirection of these links in this .htaccess file? antispyware Coding Forum 1 07-10-2007 02:00 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 06:43 PM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.