These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for [SOLVED] How can I redirect my non www URL to my www site? on the new forum.
Hi there,
I've given up on trying to do this in my .htaccess file and I'd like to try to do this through Webmin. Could you please tell me how to do this redirection please?
I know it's in the Aliases and Redirects section of Apache, but I need some instructions please.
Thank you
In two ways:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
ServerName example.com
Redirect permanent / http://www.example.com/
- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.
Hi and thanks for your response.
I already had something similar in both my .htaccess and the "Alias and Redirects" section of Webmin. I was hoping that your code would solve the problem but unfortunately it persists.
I get this weird code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Index of /</title>
</head>
<body>
<h1>Index of /</h1>
<table><tr><th><img src="/icons/blank.gif" alt="[ICO]"></th><th><a href="?C=N;O=D">Name</a></th><th><a href="?C=M;O=A">Last modified</a></th><th><a href="?C=S;O=A">Size</a></th><th><a href="?C=D;O=A">Description</a></th></tr><tr><th colspan="5"><hr></th></tr>
<tr><th colspan="5"><hr></th></tr>
</table>
</body></html>
Which looks like this: https://s32.postimg.org/3l1rackp1/Capture.png
Any ideas as to what could be going on?
Thank you
You should reset everything back to default values (including Aliases and Redirects) and then try with my suggestion. When i can i always prefer Apache but you can choose what you think it will be better in your case, just remember there is no need to have both.
About "Aliases and Redirects" i never used so i dont know how it works and if it works.
- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.
Well, after much searching I figured out that what was being served was a cached mod_pagespeed page. So I cleared the cache with
touch /var/cache/mod_pagespeed/cache.flush
and it works.Thanks for your help.