New Website Technology is changing our URL's

Discuss practical ways rearrange URLs using mod_rewrite.

New Website Technology is changing our URL's

Postby tir-ct » Tue Aug 12, 2008 12:13 pm

I am needing help implementing mod_rewrite on our server for one of our websites. I am not a programmer and don't know mod_rewrite at all but I have done a lot of research and have determined that this is our best bet to achieve what we need to do. We are moving our website to a new technology which means all of our URL's are changing. Our website is well indexed and ranks well for many of our targeted keywords. I need to use mod-rewrite to rewrite what will be our "new" URL's to "look like" our old URL's. The change to our new website hasn't taken place yet so we have some time to make this change.

Here is what an example of the new URL will look like:
http://www.tirmassagestone.com/productS ... ID=1000028

This is what the "current" URL is (what it needs to continue to look like, and from what I understand, what it needs to be "rewritten" to) :
http://www.tirmassagestone.com/products ... index.html

Is there someone that can point me in the right direction on how to do this or a company or individual that i can get to this for me? There are a good number of URL's that will need to be rewritten (between 100 & 150).

Thanks,
Chris
tir-ct
 
Posts: 3
Joined: Tue Aug 12, 2008 12:03 pm

Postby richardk » Wed Aug 13, 2008 12:33 pm

richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby tir-ct » Fri Aug 22, 2008 3:45 pm

I read through the FAQ's page that you suggested, most of it didn't make sense (as I said I am not a programmer). I did however do the little test with redirecting to Google to see if mo_rewrite was turned on and working. It worked just fine, it redirected to google.com like it should.

I think I just need the general format on how to make the browser (and therefore SE spider) see a certain URL as explained in my first post.

Since my URL's will be changing and I want to rewrite them to be what they are currently (what have been around for 4 years and what the SE's have indexed) is it necessary to use the 301 redirect directive since it is not changing from what the URL is currently?

For example a URL on my website is:

www.mysite.com/products/index.html

and using mod_rewrite I want it to be rewriting to remain as such even when the website technology change that is happening next week would change them to be different?
tir-ct
 
Posts: 3
Joined: Tue Aug 12, 2008 12:03 pm

Postby richardk » Sat Aug 23, 2008 10:09 am

Here is what an example of the new URL will look like:
/productServlet?M_Product_Category_ID=1000028

This is what the "current" URL is (what it needs to continue to look like, and from what I understand, what it needs to be "rewritten" to) :
/products/massagestones/index.html

The problem is, if you give mod_rewrite "massagestones" it can't just guess the ID. Therefore you have to do one of the five things from the FAQ post
  • Use a RewriteMap. This requires access to the httpd.conf file, not just the ability to use .htaccess files. Do you have access to the httpd.conf file?
  • Change the URL to include the ID, eg. /products/massagestones-1000028/index.html
  • Edit the script so it doesn't use the ID (so it only uses "massagestones").
  • Write a new script to get the ID.
  • Make a rule for each product.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby tir-ct » Sat Aug 23, 2008 8:22 pm

So if I make a rule for each product how would l do that? I think that is going to be my best bet so I can specify exactly what it needs to be rewritten from and to.

Thanks for your help.
tir-ct
 
Posts: 3
Joined: Tue Aug 12, 2008 12:03 pm

Postby richardk » Sun Aug 24, 2008 2:18 pm

Like this
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^products/example/index\.html$       /productServlet?M_Product_Category_ID=0000001 [QSA,L]
RewriteRule ^products/massagestones/index\.html$ /productServlet?M_Product_Category_ID=1000028 [QSA,L]
# etc.

You have to edit the new script to output these URLs, through. You could change QSA to R=301 for a permanent redirect. Though, if you are going to do a redirect, you should use Redirect
Code: Select all
Redirect 301 /products/example/index.html       http://example.com/productServlet?M_Product_Category_ID=0000001
Redirect 301 /products/massagestones/index.html http://example.com/productServlet?M_Product_Category_ID=1000028
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 5 guests

cron