Newb redirect question

Hey guys,

I am fairly new to the linux world and need to know how to redirect my site from:

li375-xx.members.linode.com

to

mydomain.com

My site is currently showing on both these domains.

I would like a 301 redirect that keeps the path intact. (li375-xx.members.linode.com/halloween would redirect to mydomain.com/halloween)

I also have wordpress installed and everything I've tried is not working. I also created a cname hoping it would redirect from li375-xx.members.linode.com to mydomain.com but no luck there also.

Can you tell me what to do and where the code should go?

I installed the stacksript: Ubuntu 10.04 LTS and 'WordPress' StackScript at revision 146

Running the LAMP stack that is.

Thanks!

Derek

2 Replies

Heya Derek,

You should be able to achieve this just by messing around with the Apache configuration a bit. If you haven't already set up virtual hosting, you should do that now. The guide here may be helpful if you run into any trouble following the instructions below:

If you haven't already set up virtual sites, then presumably you are currently using the 000default site for everything (that is to say, currently both the li375-xx.members.linode.com and the mydomain.com sites will be using the 000default site config in apache). This is fine, and we can create a new virtual site just for li375-xx.members.linode.com which will forward to the default site. To do this you'll need to do something along the lines of…

__cd /etc/apache2/sites-available/

touch li375-xx.members.linode.com__

At this point, edit the content of /etc/apache2/sites-available/li375-xx.members.linode.com (you can use nano li375-xx.members.linode.com) and set it to the following:

 <virtualhost *:80="">ServerName li375-xx.members.linode.com
     Redirect 301 / http://mydomain.com/</virtualhost> 

Save the file, and then add the site to apache and reload apache:

__a2ensite li375-xx.members.linode.com

/etc/init.d/apache2 reload__

That should sort you out. Give a shout if you run into any problems. I've made a few assumptions about the way you have things set up at the moment, so it may not work 100%.

Best!

Why would you want to use li375-xx.members.linode.com at all?

Just setup and use your real domain name.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct