Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am completely new to (& am completely lost with) apache commands. I am working on a new J! installation that is intended to be a replacement of the clients existing regular html site.

New site will use:

  • Joomla 2.5
  • Virtuemart 2.0.18a
  • iDevAffiliate (holding back on purchase to make sure this will work)

The client currently has a shopping cart system, and an affiliate system using Post Affiliate pro. There are 1000+ affiliates that have all been given a url based on their username. They are posted on forums, banner ad's, printed material, etc

It is vital to the company that these url's remain the same and work with iDevAffiliate.

SO! We need to re-write these existing url's, (originally generated by Post Affiliate pro) from this:

http://domain-name.com/username1

http://domain-name.com/username2

to this:

http://domain-name.com/folder/idevaffiliate.php?001

http://domain-name.com/folder/idevaffiliate.php?002

iDev will generate new url's based on the new usernames. 001, 002 will be the new userid format and will correspond directly to each of the 1000+ specific users/affiliates.

In my research I'm seeing that 301 redirect mod_rewrite in .htaccess and a translation table is going to be necessary? Am I on the right track?

I would most certainly prefer that an automated process for this could be achieved but if each URL needs to be rewritten so be it.

What are my real options and how do I approach this problem? Any help or suggestions would be greatly appreciated! :p

-Brad DuBois Positive Designs

share|improve this question
    
You're on the right track. Just one question first - are the old usernames actuall numbered, i.e. do they look like "username1", "username2" and so on, or are they actual names? If the former, you could do it with a few regexp lines. If the latter, you'll need a translation table (which could presumably be generated by your system.) –  Jenny D Jan 28 '13 at 11:38

1 Answer 1

Using RedirectMatch,

RedirectMatch 301 ^/username(.*)$ http://domain-name.com/folder/idevaffiliate.php?00$1

Give that a try, you might want to be more specific with the regex rule, but that should work ok, if they are just hitting /username1, etc.

share|improve this answer
    
That will work for username1 to username9 - probably once you get to username10 they will want the new URL to be idevaffiliate.php?010 rather than idevaffiliate.php?0010 . –  Jenny D Jan 28 '13 at 13:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.