954,242 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

301 using regex

Hi We have moved our site with a new system with a new structure. the domain is the same just structural changes, and I cant seem to get the htaccess right.

Here is what i am trying to accomplish:

move this: http://www.domain.com/chairs/519.htm
to: http://www.domain.com/catalogsearch/result/?q=519

we have over 5000 links so I was hoping that the "?q=" could have the sku number (519) after it dynamically.

Example, if a search was made for anything ending 600.htm it would go to http://www.domain.com/catalogsearch/result/?q=600

any advise is greatly appreciated.

andy106
Newbie Poster
20 posts since Aug 2010
Reputation Points: 10
Solved Threads: 1
 

Hi We have moved our site with a new system with a new structure. the domain is the same just structural changes, and I cant seem to get the htaccess right.

Here is what i am trying to accomplish:

move this: http://www.domain.com/chairs/519.htm to: http://www.domain.com/catalogsearch/result/?q=519

we have over 5000 links so I was hoping that the "?q=" could have the sku number (519) after it dynamically.

Example, if a search was made for anything ending 600.htm it would go to http://www.domain.com/catalogsearch/result/?q=600

any advise is greatly appreciated.


Ok so i got this working with this:

RedirectMatch /([0-9+].*)\.htm$ http://www.domain.com/catalogsearch/result/?q=$1

but I now realized that not all our links from previous site was uniform, some have a url like http://www.domian.com/Xtra-Tall-Chairs-5200-55-9800.htm granted that my above match rule ignores anything but numbers, but how can i have it take the "55" only so http://www.domain.com/catalogsearch/result/?q=$1 becomes http://www.domain.com/catalogsearch/result/?q=$55

Thanks

andy106
Newbie Poster
20 posts since Aug 2010
Reputation Points: 10
Solved Threads: 1
 

Ok i got it! thanks for all your help.

andy106
Newbie Poster
20 posts since Aug 2010
Reputation Points: 10
Solved Threads: 1
 

Man, are we fast! Superluminal (faster than light speed) for sure! :-)

rubberman
Posting Virtuoso
1,559 posts since Mar 2010
Reputation Points: 277
Solved Threads: 178
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: