Forum Moderators: phranque
I have recently had the misfortune to get banned from google for having duplicate content (I think). Anyway, to clean things up I've set up a 301 redirect from the site which had similar content on it to the site which I wanted to keep.
The problem is that I can no longer access the control panel for the old site as I now get redirected to the other site.
Is there anyway I can redirect all traffic from the site except for anyone trying to access the admin folder?
Thanks in advance
stubbsy
all I did to acheive the redirect was to add this line of code to the current htaccess file
redirect 301 / http://www.example.com/
kind regards
stubbsy
the full htaccess reads this ....
# $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>
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}
Options All -Indexes
redirect 301 / http://www.example.com/
[edited by: jdMorgan at 4:34 pm (utc) on Aug. 22, 2005]
[edit reason] Removed specifics per TOS. [/edit]
You will need to insert the ful local URL-path to your control panel subdirectory in the RewriteCond line as shown.
Note that I took the liberty of cleaning up your other rules so that they will run a lot faster. However, since the domain rewrite rule is invoked first, those rules won't run, and you can safely delete them *after* and *if* you get the domain rewrite working. You may be able to use the technique shown for the rewrites on your 'real' domain.
Options All -Indexes
#
RewriteEngine On
RewriteBase /
#
RewriteCond %{REQUEST_URI} !^/local_path_to_your_control_panel
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
#
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}
Sorry to trouble you again but I can't appear to get the rewritecond to work. I'm have tried everything i can think of any just geet a 404.
For the rewritecond line I have tried a number of things, the control panel is in the admin folder in the root of that domain.
The full path is
RewriteCond %{REQUEST_URI}!^/home/stubbsy/public_html/example/admin/
Is that what I should have in there?
The http addy would be http://www.example.com/admin/index.php
Thanks again for your time
stubbsy