Solved

redirect domain.com to www.domain.com

Posted on 2008-10-26
3
972 Views
Last Modified: 2013-11-15
I am using googlemaps and the api key is for www.domain.com.

My website is both accessible at domain.com and www.domain.com by configuring a file in sites-avalaible as
ServerName www.domain.com
ServerAlias domain.com

The website use Joomla 1.5.7.

Hence i dont get a map for domain.com

Thanks
0
Comment
Question by:rroslan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 22810979
Try to place [1] into the file, where you placed 'ServerAlias domain.com'. But first, check your server config if the module mod_rewrite is loaded (LoadModule section).
[1]:
 
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^/(.*) http://www.domain.com/$1 [R=301,L]

Open in new window

0
 

Author Comment

by:rroslan
ID: 22812474
Theres a '\' in the above after the '^domain\.com' which I did not include, thought it might be a typo error. Anyway its working for the config as below. Thanks
<VirtualHost *>
DocumentRoot "/home/roslan/Joomla_RT_HiveMind_j15"
ServerName www.domaini.edu.my
ServerAlias domain.edu.my
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.edu.my
RewriteRule ^/(.*) http://www.domain.edu.my/$1 [R=301,L]
<Directory "/home/roslan/Joomla_RT_HiveMind_j15">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
0
 
LVL 27

Expert Comment

by:caterham_www
ID: 22814751
> Theres a '\' in the above after the '^domain\.com'

Yes, \. stands for period, otherwise the . (period) does not mean period but any characher in a regular espression.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
After running Ubuntu some time, you will be asked to download updates for fixing bugs and security updates. All the packages you download replace the previous ones, except for the kernel, also called "linux-image". This is due to the fact that w…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question