• Hi
    I’ve read through and implemented a number of things re the redirect of non www urls to www but I can’t seem to get it to work.
    This is my .htaccess file

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{http_host} ^schoolpics.co.uk [NC]
    RewriteRule ^(.*)$ https://www.schoolpics.co.uk/$1 [L,R=301]
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    https://www.schoolpics.co.uk/

    I’ve confirmed that both urls in settings>general include the wwww.

    Is there something else I should be trying or somewhere else I should be looking?
    Thanks in advance
    Sue

Viewing 10 replies - 1 through 10 (of 10 total)
  • C W (VYSO)

    (@cyril-washbrook)

    Try capitalising HTTP_HOST in line 4.

    Anonymous User 14733231

    (@anonymized-14733231)

    TRY

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^schoolpics.co.uk[NC]
    RewriteRule ^(.*)$ https://www.schoolpics.co.uk/$1 [L,R=301]

    Thread Starter suehami

    (@suehami)

    Thank you to both of you. I’ve tried capitalising the HTTP_HOST but it’s still not working.
    Thanks
    Sue

    Anonymous User 14733231

    (@anonymized-14733231)

    Hello please try with below code

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    RewriteCond %{HTTP_HOST} ^example.com
    RewriteRule (.*) https://www.example.com/$1 [R=301,L]

    Replace example.com with your site name

    Thread Starter suehami

    (@suehami)

    Neal Thanks
    but that made a right mess of things
    the www. url gave this:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    and non www still gave

    Server not found

    Thanks anyway

    If this code doesn’t work it’s a server configuration issue. I’m using this exact code and it works fine. Your server may not have rewrite enabled.

    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
    Anonymous User 14733231

    (@anonymized-14733231)

    Hello Suehami,

    Might be Your server configuration issue. Please rewrite enabled.

    Thread Starter suehami

    (@suehami)

    Hi Neal
    I was beginning to think much the same thing.
    Thanks
    Sue

    Anonymous User 14733231

    (@anonymized-14733231)

    Ok Thank you let me know if i can help you further.

    Thread Starter suehami

    (@suehami)

    Will do, thanks again for taking the time Neal

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘htaccess non www to www redirect not working’ is closed to new replies.