1

Hi hopefully someone can help. I have added a 301 redirect to change from an old domain name to a new domain. The magento build is still on the old domain also (but with no follow / no index)

I want to keep the installation on the old domain also for order reference etc.

I have added the following to the hta access file, but obviously this also stops me being able to access the admin side of the site.

How can I add an exclude on the following so that I can redirect all - apart from the admin and so this can still be accessed.

#Redirect from old domain to new domain
RewriteEngine on
RewriteBase /
RewriteRule (.*) http://www.b.co/$1 [R=301,L]
2

You can try the following:

RewriteEngine on 
RewriteBase / 
RewriteCond %{REQUEST_URI} !^/admin
RewriteCond %{REQUEST_URI} !^admin
RewriteCond %{REQUEST_URI} !^/index.php/admin
RewriteCond %{REQUEST_URI} !^index.php/admin
RewriteRule (.*) http://www.b.co/$1 [R=301,L]

You can change admin if you use another path for your admin area.

1

Try this in your .htaccess:

Options +FollowSymLinks

RewriteEngine On

RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
# Match the sub domain (if there is one).
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.com$ [NC]
# %1 is the sub domain (or empty).
RewriteRule ^(.*)$ http://%1example.net/$1 [R=301,L]
1

This version will allow you to still see the admin styles.

RewriteEngine on 
RewriteBase / 
RewriteCond %{REQUEST_URI} !^/admin
RewriteCond %{REQUEST_URI} !^admin
RewriteCond %{REQUEST_URI} !^/skin
RewriteCond %{REQUEST_URI} !^/js
RewriteCond %{REQUEST_URI} !^/media
RewriteCond %{REQUEST_URI} !^/index.php/admin
RewriteCond %{REQUEST_URI} !^index.php/admin
RewriteRule (.*) http://www.b.co/$1 [R=301,L]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.