0

I have the following in a .htaccess file:

# 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

I have tried the following but it does not work:

RewriteRule ^this-url$ http://www.anotherdomain.com/ [NC,L,R=301]

Any idea how I can resolve this?

Regards,

Neil.

2 Answers 2

2

It should work with your rule, but it must be placed before those concerning WordPress (Always redirect before rewriting):

RewriteEngine On
RewriteRule ^this-url$ http://www.anotherdomain.com/ [NC,L,R=301]

# 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
Sign up to request clarification or add additional context in comments.

Comments

0

i'm using this code for my htacces to redirect to another website.

RewriteEngine On
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R=301,L]

That should work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.