How to redirect www.domain.co.za to http.domain.co.za

Need help with the Administration of your Joomla! 3.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
abelm
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Jun 12, 2019 1:29 pm

How to redirect www.domain.co.za to http.domain.co.za

Post by abelm » Tue Jun 09, 2020 3:30 pm

Hi,

Our joomla(3.9.8) website is running on xampp and apache server. For now the website can only be accessible through http://domain.co.za. I want the website to also redirect from www.domain.co.za. to http://domain.co.za I tried coding the redirect in htaccess using the following codes:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
</IfModule>

And

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.co.za [NC]
RewriteRule ^(.*)$ http://domain.co.za/$1 [L,R=301]
</IfModule>

#Force non-www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.co.za [NC]
RewriteRule ^(.*)$ http://domain.co.za/$1 [L,R=301]

and many more but still I don't get this right.

I have mod_rewrite.c enabled.

Can you please advise me how should I get this work? which code should I use?

Thanks.

Abel
Last edited by toivo on Tue Jun 09, 2020 10:29 pm, edited 1 time in total.
Reason: mod note: moved from 3.x Migrating and Upgrading

 
User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 20144
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ UK/ S'pore/Jakarta/ North America
Contact:

Re: How to redirect www.domain.co.za to http.domain.co.za

Post by leolam » Tue Jun 09, 2020 6:51 pm

You are missing something essential in your thinking. the 'www' is actually considered a "subsomain" by Apache

So I assume you want to redirect from http://www.domainname.com to http://domain.com and you also need for sure

http:// domain.com to redirect to https://domain.com

Correct? confirm and I give you the .htaccess entries

Leo 8)
Joomla's #1 Professional Services Provider:
#Joomla Professional Support: https://gws-desk.com -
#Joomla Specialized Hosting Solutions: https://gws-host.com -
#Joomla Webmaster Services: gws-webmaster.services

abelm
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Jun 12, 2019 1:29 pm

Re: How to redirect www.domain.co.za to http.domain.co.za

Post by abelm » Wed Jun 10, 2020 11:09 am

Hi Leo,

Yes, you are correct I want to redirect from http://www.domainname.com to http://domain.com but not the https://domain.com part of it as we don't have certificate applied yet.

Thank you for your reply.

Kind Regards,
Abel

abelm
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Jun 12, 2019 1:29 pm

Re: How to redirect www.domain.co.za to http.domain.co.za

Post by abelm » Thu Jul 02, 2020 10:39 am

Hi Leo,

I trust you well.

I still did not manage to get this work.

Can you please give me the .htaccess entries to redirect the site?

Thank you in advance.

Kind Regards,
Abel

 

Post Reply

Return to “Administration Joomla! 3.x”