Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

URL Redirect


JrrSIN

Recommended Posts

Hello,

 

I need to redirect a few product pages to a single page where all these products are now listed, they are the same, just different colors.

 

So I wrote in the .htaccess file on the root:

 

Redirect 301 /OLD-product-pink-p-266.html http://mysite.com/NEW-product-p-264.html

Redirect 301 /OLD-product-blue-p-264.html http://mysite.com/NEW-product-p-264.html

Redirect 301 /OLD-product-green-p-265.html http://mysite.com/NEW-product-p-264.html

 

If I click on

 

http://mysite.com/OLD-product-green-p-265.html

 

I get redirected to:

 

http://mysite.com/NEW-product-p-264.html?products_id=265

 

The first part of the URL before the ? symbol is correct, that is the URL for the new page. However it adds ?products_id=265 from the old page and I end up in the 'Product Not Found' page.

The only one that works is http://mysite.com/NEW-product-p-264.html?products_id=264 This one lands in the right page because the OLD and NEW pages have the same product ID I guess.

 

Any ideas?

 

Here is the complete .htaccess for your reference

 

Thanks for your help

 

______________________________________________________

 

#RewriteEngine On

#RewriteCond %{SERVER_PORT} !^443$

#RewriteRule ^(.*)$ https://www.mysite.com/$1 [L,R]

 

# $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>

 

# If Search Engine Friendly URLs do not work, try enabling the

# following Apache configuration parameter

#

# AcceptPathInfo On

 

# 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>

 

# Directive to turn register globals off on servers where it is on

#php_flag register_globals Off

 

# Directive to ensure gzip works properly

# php_flag zlib.output_compression On

 

# Optionally compression level

# php_value zlib.output_compression_level 5

 

# Options +FollowSymLinks

 

# Ultimate SEO URLs

RewriteEngine On

# Change this next line to wherever your store is installed

# If your store is installed at the root of your webspace just use /

# RewriteBase /catalog/

 

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-m-([0-9]+).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pi-([0-9]+).html$ popup_image.php?pID=$2&%{QUERY_STRING}

RewriteRule ^(.*)-t-([0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-a-([0-9]+).html$ article_info.php?articles_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING}

 

## Shamelessly ganked from Joomla! Thanks guys! You can add any other validation you feel is necessary here

########## Begin - Rewrite rules to block out some common exploits

## If you experience problems on your site block out the operations listed below

## This attempts to block the most common type of exploit `attempts` to Joomla!

#

# Block out any script trying to base64_encode crap to send via URL

RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]

# Block out any script that includes a <script> tag in URL

RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]

# Block out any script trying to set a PHP GLOBALS variable via URL

RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]

# Block out any script trying to modify a _REQUEST variable via URL

RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})

# Send all blocked request to homepage with 403 Forbidden error!

RewriteRule ^(.*)$ index.php [F,L]

#

########## End - Rewrite rules to block out some common exploits

 

Redirect 301 /OLD-product-pink-p-266.html http://mysite.com/NEW-product-p-264.html

Redirect 301 /OLD-product-blue-p-264.html http://mysite.com/NEW-product-p-264.html

Redirect 301 /OLD-product-green-p-265.html http://mysite.com/NEW-product-p-264.html

Link to comment
Share on other sites

try

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

Redirect 301 /OLD-product-pink-p-266.html http://mysite.com/NEW-product-p-264.html
Redirect 301 /OLD-product-blue-p-264.html http://mysite.com/NEW-product-p-264.html
Redirect 301 /OLD-product-green-p-265.html http://mysite.com/NEW-product-p-264.html

RewriteEngine On
# Change this next line to wherever your store is installed
# If your store is installed at the root of your webspace just use /
# RewriteBase /catalog/

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

## Shamelessly ganked from Joomla! Thanks guys! You can add any other validation you feel is necessary here
########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...