Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue Sep 20, 2011 3:42 pm 
Offline
Newbie

Joined: Tue Sep 20, 2011 3:35 pm
Posts: 2
Hi guys, I've a got a domain.com and a subdomain.domain.com
I want that users going to www.domain.com and domain.com get redirected to subdomain.domain.com.

Right now I'm using this in the .htaccess
Code:

RedirectMatch 301 ^(.*)$ / http://subdomain.domain.com/$1


But it doesn't work. Any idea?
Thank you in advance


Top
   
 Post subject:
PostPosted: Tue Sep 20, 2011 4:01 pm 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
We'll need to know what software you use for your web server (apache, nginx, etc) to give you a proper url rewrite rule.

Another possibility is to place an index.html in the web root for domain.com that contains the following code (adjust as necessary):
Code:
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv="REFRESH" content="0;url=http://subdomain.domain.com/">
</head>
<body>
Optional page text here.
</body>
</html>

This is basically just an html redirect, so when someone visits domain.com and their browser loads index.html, it will see the <meta> tag telling it to "refresh to url", or in other words, to redirect to another url.

_________________
Kris the Piki Geeker


Top
   
 Post subject:
PostPosted: Tue Sep 20, 2011 4:18 pm 
Offline
Newbie

Joined: Tue Sep 20, 2011 3:35 pm
Posts: 2
Yeah sorry, I forgot to mention that I use apache


Top
   
 Post subject:
PostPosted: Tue Sep 20, 2011 6:59 pm 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
I'm not familiar with url rewrites in apache, but as far as I can tell from Google, you need to have the following line inserted into .htaccess before you define any rewrites/redirects:
Code:
RewriteEngine on

Then below this, you may define your rewrites/redirects.

_________________
Kris the Piki Geeker


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group