Report this

What is the reason for this report?

Basic 301 redirection not working

Posted on February 5, 2015

I have two domains forwarding to my digital ocean account, both are working and showing the correct files.

However one is an old domain that I want to forward to my new one.

I have gone through the steps of making sure mod_rewrite is on and have added this to the .htacces next to the index.html file that both of these domains are serving.

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^jordanrdesigns.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.jordanrdesigns.com$
  RewriteRule (.*)$ http://www.jordanriser.com/$1 [R=301,L]
</IfModule>

However when pulling this update into my site, going to the old domain is not forwarding to the new domain.

My site is in the default location which on my server is /var/www/html/

Do I instead need to do this in a conf file possibly? I have two other websites I’m hosting on my server that I setup to go to specific folders via a .conf file, not sure if that has anything to do with this issue.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi, experts, I am trying 301 redirections for my site **(www.earabictoenglish.com) **so I used the following code, but it is not working! Can anyone please find out the error and help me to solve the 301 issue.

RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^earabictoenglish.com [NC] RewriteRule ^(.*)$ http://www.earabictoenglish.com/$1 [L,R=301]

RewriteEngine on RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.pages\ HTTP/ RewriteRule ^index.pages$ http://www.earabictoenglish.com/ [R=301,L]

Please help to redirect my site.

Your .htaccess should do the trick. If you have enabled mod_rewrite you will also need to make sure that your virtualhost configuration has AllowOverride All instead of AllowOverride None set for your web root directory. Otherwise apache will ignore directives in the .htaccess file.

This comment has been deleted

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.