PDA

View Full Version : 301 redirects - where to add them? htaccess breaks site



cvwd
03-25-2012, 09:59 PM
Hi All

I just moved a clients old site over to my server using a new install of oscmax.

I need to add some 301 redirects for their old pages but whenever I edit the htaccess file the site breaks.

I have tried it in both the root htaccess and the one in templates.

Where do I add them please?

Example of code used

//301 Redirect Old File
Redirect 301 http://www.bodywise.com.au/asset.asp?IDA=447662 http://www.bodywise.com.au

pgmarshall
03-26-2012, 12:22 AM
Add them in the root of the old site. Since you are using the same domain then simply add to the root one. Have you got "RewriteEngine on" - if you edit the one that came with osCmax this line is in there but commented out for the custom error handling. Regards.

cvwd
03-26-2012, 02:11 PM
I have oscmax setup in the root directory.

Will take a look at the commented out bits and see how I go - thanks for your reply.

cvwd
03-27-2012, 09:31 PM
Ok sorry if im being a total noob but I have uncommented some code in htaccess but still not sure where or how I can add my 301 redirects.

I was getting a 500 error when adding the redirect code but now that is not happening.

However after adding the code, going to the said page just brings up the 404 page and does not redirect.

What am I doing wrong?

HTACCESS CODE

#$Id: .htaccess.new 1020 2011-01-07 01:18:29Z michael.oscmax@gmail.com $


#

# osCmax e-Commerce

# http://www.oscmax.com

#

# Copyright 2000 - 2011 osCmax

#

# Released under the GNU General Public License

#

#

# 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



# BOF: Mod RC2A

#<IfModule mod_setenvif.c>

# <IfDefine SSL>

# SetEnvIf User-Agent ".*MSIE.*" \

# nokeepalive ssl-unclean-shutdown \

# downgrade-1.0 force-response-1.0

# </IfDefine>

#</IfModule>

# EOF: Mod RC2A



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

# BOF: MOD - Ultimate SEO URLs

## SEO Url's .htaccess file

## If you want to use the Apache Mod-Rewrite method for SEO URL's

## NOTE: This requires that you are on an apache web server with mod_rewrite enabled.



<IfModule mod_rewrite.c>

Options +FollowSymLinks

RewriteEngine On



# Change "catalog" to your catalog directory name:

#RewriteBase /catalog/

## If installed to the base home/root directory, uncomment the below code only:

RewriteBase /

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}

</ifModule>

# EOF: MOD - Ultimate SEO URLs



# BOF: HTTP Error Logging

# NOTE: if you've installed the catalog in a different directory, change /catalog/ below. Don't leave of the leading /.

ErrorDocument 400 /http_error.php?error_id=400

ErrorDocument 401 /http_error.php?error_id=401

ErrorDocument 403 /http_error.php?error_id=403

ErrorDocument 404 /http_error.php?error_id=404

ErrorDocument 405 /http_error.php?error_id=405

ErrorDocument 408 /http_error.php?error_id=408

ErrorDocument 415 /http_error.php?error_id=415

ErrorDocument 500 /http_error.php?error_id=500

ErrorDocument 501 /http_error.php?error_id=501

ErrorDocument 502 /http_error.php?error_id=502

ErrorDocument 503 /http_error.php?error_id=503

ErrorDocument 505 /http_error.php?error_id=505

ErrorDocument 504 /http_error.php?error_id=504

# EOF: HTTP Error Logging

Redirect 301 http://www.bodywise.com.au/asset.asp?IDA=447662 http://www.bodywise.com.au

ridexbuilder
03-28-2012, 01:17 AM
A 'noob' "decides", in their wisdom, to change from the default catalog install and gets in a pickle.
So now, instead of messing about with the catalog .htaccess, they're getting ready to screw up the main webserver file.
Let that be a lesson to others.

pgmarshall
03-28-2012, 10:29 AM
Have you tried putting the 301 redirect before the 404 redirect?

cvwd
03-28-2012, 02:33 PM
Clients do not like having the file structure of catalog it is also incorrect spelling for Australia, being catalogue.

Thank you @pgmarshall for your helpful post, I will try that and see how I go.