0

My website www.xyz.co.uk. this website in some old link www.abc.co.uk/xxx i need to user click on any old link then redirect www.xyz.co.uk page. i try htaccess rule write but not working.

# Redirect to xyz.co.uk

<IfModule mod_rewrite.c>

    # For security reasons, Option followsymlinks cannot be overridden.

    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^abc.co.uk [OR]
    RewriteCond %{HTTP_HOST} ^www.abc.co.uk [NC]
    RewriteRule ^(.*)$ http://www.xyz.co.uk/$1 [L,R=301]

</IfModule>

# Redirect to xyz.co.uk end
Mike Rockétt
  • 8,947
  • 4
  • 45
  • 81

1 Answers1

0

You can try this:

RewriteEngine On

# If not using the new domain, then redirect to it
RewriteCond %{HTTP_HOST} !www.xyz.co.uk$ [NC]
RewriteRule ^(.*)$ http://www.xyz.co.uk/$1 [L,R=301]

Or this:

Redirect 301 / http://www.xyz.co.uk/

In the first example, make sure that AllowOverride is set to All in your Apache configuration.

Community
  • 1
  • 1
Mike Rockétt
  • 8,947
  • 4
  • 45
  • 81