WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] htaccess 301 redirect for .net and .co.uk to .com for all pages (3 posts)

  1. orangemint123
    Member
    Posted 3 months ago #

    Hi, I've searched a lot for this but can't find the solution.
    I have a domain for mccartney-maxwell.co.uk, .net and .com and want to use the .com as the default address.

    Here is what my htaccess looks like atm but it doesn't work for any pages other than the homepage. e.g. if I navigate to mccartney-maxwell.co.uk/job-opportunities it doesn't change to .com

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^(www\.)?mccartney-maxwell\.com$ [NC]
    RewriteRule ^(.*) http://www.mccartney-maxwell.com/$1 [R=301,NE,L]

    Can anyone suggest what's wrong please?

  2. That ought to work but just one thing: put this part on top of the file.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^(www\.)?mccartney-maxwell\.com$ [NC]
    RewriteRule ^(.*) http://www.mccartney-maxwell.com/$1 [R=301,NE,L]

    Then that should do it.

  3. orangemint123
    Member
    Posted 3 months ago #

    Sorted thanks :)

Reply

You must log in to post.

About this Topic