Forum Moderators: phranque

Message Too Old, No Replies

.htaccess file question

Is this the right way to do this?

         

OldPete

7:45 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



Hi,

I have the following .htaccess file:

::: CODE START :::


# $Id: .htaccess,v 1.3 2003/06/12 10:53:20 hpdl Exp $
#
# This is used with Apache WebServers
#
# For this to work, you must include the parameter 'Options' to
# the AllowOverride configuration
#
# Example:
#
# <Directory "/usr/local/apache/htdocs">
# AllowOverride Options
# </Directory>
#
# 'All' with also work. (This configuration is in the
# apache/conf/httpd.conf file)

# The following makes adjustments to the SSL protocol for Internet
# Explorer browsers

<IfModule mod_setenvif.c>
<IfDefine SSL>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
</IfDefine>
</IfModule>

# Fix certain PHP values
# (commented out by default to prevent errors occuring on certain
# servers)

#<IfModule mod_php4.c>
# php_value session.use_trans_sid 0
# php_value register_globals 1
#</IfModule>
#
#
#
# Spider Fix Added below
#
#
#
# $Id: .htaccess,v 1.3 2003/06/12 10:53:20 hpdl Exp $

# Set some options
Options -Indexes
Options FollowSymLinks

RewriteEngine on
RewriteBase /
#
# Skip the next two rewriterules if NOT a spider
RewriteCond %{HTTP_USER_AGENT}!(msnbot¦slurp¦googlebot) [NC]
RewriteRule .* - [S=2]
#
# case: leading and trailing parameters
RewriteCond %{QUERY_STRING} ^(.+)&osCsid=[0-9a-z]+&(.+)$ [NC]
RewriteRule (.*) $1?%1&%2 [R=301,L]
#
# case: leading-only, trailing-only or no additional parameters
RewriteCond %{QUERY_STRING} ^(.+)&osCsid=[0-9a-z]+$¦^osCsid=[0-9a-z]+&?(.*)$ [NC]
RewriteRule (.*) $1?%1 [R=301,L]

#
# This is used with Apache WebServers
#
# For this to work, you must include the parameter 'Options' to
# the AllowOverride configuration
#
# Example:
#
# <Directory "/usr/local/apache/htdocs">
# AllowOverride Options
# </Directory>
#
# 'All' with also work. (This configuration is in the
# apache/conf/httpd.conf file)

# The following makes adjustments to the SSL protocol for Internet
# Explorer browsers

<IfModule mod_setenvif.c>
<IfDefine SSL>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
</IfDefine>
</IfModule>

# Fix certain PHP values
# (commented out by default to prevent errors occuring on certain
# servers)

#<IfModule mod_php4.c>
# php_value session.use_trans_sid 0
# php_value register_globals 1
#</IfModule>

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-(.*).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-(.*).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-(.*).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-(.*).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-(.*).html$ information.php?info_id=$2&%{QUERY_STRING}

::: CODE END :::

I would like to know two things, if somebody wouldn't mind helping me out please.

A) Will this code still allow google and yahoo, etc. to index my site properly or is there something about it that they will not or might now like?

B) Is there a better way to do it? If so... Can you steer me in the right direction?

Thanks for your help and time, I appreciate it more than you know.

Pete

FalseDawn

2:03 am on Nov 23, 2005 (gmt 0)

10+ Year Member



This is the OSCommerce "Ultimate URLs" hack, so should be fine, as long as you are not having problems with your site. It's not the most efficient of "best" way of getting keywords in your URL, but it works.

I'm not sure what the section of code below is for - is it a OSCSID killer? If so, if your site is configured correctly (usually cookie paths, domains), you shouldn't ever need this.

# Skip the next two rewriterules if NOT a spider
RewriteCond %{HTTP_USER_AGENT}!(msnbot¦slurp¦googlebot) [NC]
RewriteRule .* - [S=2]
#
# case: leading and trailing parameters
RewriteCond %{QUERY_STRING} ^(.+)&osCsid=[0-9a-z]+&(.+)$ [NC]
RewriteRule (.*) $1?%1&%2 [R=301,L]
#
# case: leading-only, trailing-only or no additional parameters
RewriteCond %{QUERY_STRING} ^(.+)&osCsid=[0-9a-z]+$¦^osCsid=[0-9a-z]+&?(.*)$ [NC]
RewriteRule (.*) $1?%1 [R=301,L]

OldPete

4:31 am on Nov 23, 2005 (gmt 0)

10+ Year Member



Hi,

That section of code was put there because at the very start of things MSN came and indexed the site WITH oscids in the url... which I'm sure you know the havoc that can cause.

So, I forced cookies, and added that code, which is suppose to tell the bots that if they come in on a url with the oscid to "forget" about it... and come in next time without it.

Sorry if what I'm saying doesn't make sense... my main concern is that there is something in this .htaccess file that is going to "tell" google, etc. to "go away" and/or "not index this site"...

Pllllleaseeeeeee tell me that is not the case...

FalseDawn

5:08 am on Nov 23, 2005 (gmt 0)

10+ Year Member



So that section is indeed an OscID killer. You'll know next time to set your store up correctly _before_ it gets indexed!

No, there's nothing there that will stop any bots indexing your site - that's more the domain of the robots.txt file than the .htaccess file.

OldPete

1:59 pm on Nov 23, 2005 (gmt 0)

10+ Year Member



Ahhh... Ok! Thank you!

And, yes! Next time I know *exactly* what to do. Hehe, I guess experience is the best teacher!

Thanks again,

Pete