One page on my website does not work if i do not put www. in front

January 13, 2015 1.1k views

I am using Apache virtual hosts on ubuntu 14.04 64 bit on a 512MB droplet. I have 3 very small sites setup right now. I have set up the main site to always go to even if you type in using .htaccess file. Another site i am hosting ( does not seem to follow the .htaccess file, and you can access it using the preceding www or without.

My real issue is if you go to the site with the site is if you go to it sans www, and click on sales, for some reason it puts the www. in front and puts the slash that is supposed to go in front of sales, behind it! ex: http://www.sheardlitearabians.comsales.html/

i downloaded this site from my previous shared host.

any idea what's going on here??


1 comment
  • As requested by aguilar1181

    I didn't make it clear that i have a .htaccess file for my main site and this site is in a directory inside that one, so i'm not sure if that has any bearing on it

    contents of .htaccess inside the folder where this site resides is posted below:

    Force the "www." (looking for 2 dots in the address)

    RewriteCond "%{HTTPHOST}" "!^www." [NC]
    RewriteCond "%{HTTP
    HOST}" "(.)"
    RewriteRule "(.
    )" "http://www.%1$1" [R=301,L]

    contents of .htaccess for main site:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^$ [NC]
    RewriteRule ^(.*)$$1 [L,R=301]

    BEGIN W3TC Browser Cache

    <IfModule mod_deflate.c>
    <IfModule mod_headers.c>
    Header append Vary User-Agent env=!dont-vary
    <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
    # DEFLATE by extension
    AddOutputFilter DEFLATE js css htm html xml

    END W3TC Browser Cache

    Do i just have to add RewriteEngine On in the first one? i just realized it's missing...

1 Answer

can you post your htaccess file so we can take a look?

Have another answer? Share your knowledge.