perpetuallylost
07-18-2007, 12:37 AM
I've scoured the web for a solution to my problem but haven't found one that works for me.
My site has close to 1,000 products on it. Once they are added, the database dynamically creates their product page urls as this: "site.com/detail.php?prod=abcd1234".
I have found two rewrite rules where the product can be accessed at a more friendly url - "site.com/abcd1234" that works at both these rewrite rules below...which is 'more correct' or better?
RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)(/)?$ /detail.php?prod=$1 [L]
RewriteEngine on
RewriteRule ^/?([A-Za-z0-9]+)(/)?$ /detail.php?prod=$1 [L]
However, the same product is still accessible via both urls and I don't want it to be. I am having trouble writing a redirect rule for this so that if someone does attempt to access a product through the old dynamic url "site.com/detail.php?prod=abcd1234" they are instead sent to "site.com/abcd1234". I don't want to have to create a redirect rule for each product either. So far I've either managed to either send the site through an endless loop or just redirect to the homepage.
That is the biggest issue I am having a problem with.
Another thing that I'd like to address is the fact that my site is available through several different urls:
http://www.site.com
http://www.site.com/index.php
http://site.com
http://site.com/index.php
https://www.site.com
https://www.site.com/index.php
https://site.com <- although technically the SSL certificate isn't valid without the 'www', the site data still loads.
I want visitors to continue to be able to access the site through any of these urls, but I don't want them all indexed by search engines. I would like them to be able to type in any of the urls above and use one of the urls as a main url to redirect the others to.
My questions are:
1. which of the urls above is the best to use from the SEO perspective, or does it not matter?
2. How would I write the redirect rule for all the above urls to work but redirect to 1 of the urls, and keep all the urls except for that one from being crawled by search engines?
3. Because my site uses SSL (it is only necessary for login, cart, & checkout process) would using this type of rule interfere with using SSL https?
I know this is a bunch of questions, but if anyone well versed in htaccess rules and SEO would help me out, I would be eternally grateful.
Thank you
My site has close to 1,000 products on it. Once they are added, the database dynamically creates their product page urls as this: "site.com/detail.php?prod=abcd1234".
I have found two rewrite rules where the product can be accessed at a more friendly url - "site.com/abcd1234" that works at both these rewrite rules below...which is 'more correct' or better?
RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)(/)?$ /detail.php?prod=$1 [L]
RewriteEngine on
RewriteRule ^/?([A-Za-z0-9]+)(/)?$ /detail.php?prod=$1 [L]
However, the same product is still accessible via both urls and I don't want it to be. I am having trouble writing a redirect rule for this so that if someone does attempt to access a product through the old dynamic url "site.com/detail.php?prod=abcd1234" they are instead sent to "site.com/abcd1234". I don't want to have to create a redirect rule for each product either. So far I've either managed to either send the site through an endless loop or just redirect to the homepage.
That is the biggest issue I am having a problem with.
Another thing that I'd like to address is the fact that my site is available through several different urls:
http://www.site.com
http://www.site.com/index.php
http://site.com
http://site.com/index.php
https://www.site.com
https://www.site.com/index.php
https://site.com <- although technically the SSL certificate isn't valid without the 'www', the site data still loads.
I want visitors to continue to be able to access the site through any of these urls, but I don't want them all indexed by search engines. I would like them to be able to type in any of the urls above and use one of the urls as a main url to redirect the others to.
My questions are:
1. which of the urls above is the best to use from the SEO perspective, or does it not matter?
2. How would I write the redirect rule for all the above urls to work but redirect to 1 of the urls, and keep all the urls except for that one from being crawled by search engines?
3. Because my site uses SSL (it is only necessary for login, cart, & checkout process) would using this type of rule interfere with using SSL https?
I know this is a bunch of questions, but if anyone well versed in htaccess rules and SEO would help me out, I would be eternally grateful.
Thank you