Solved

redirect domain.com to www.domain.com

Posted on 2008-10-26
3
963 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now