How can I to do My site is accessible with and without www?

September 26, 2015 1.1k views
Apache PHP CentOS


My website is accessible without "www"
but I already have a .htaccess rule... What is the problem?
Why my .htaccess is not read? My .htaccess is into directory of my site...

I am using:

```RewriteEngine on
RewriteCond %{HTTPHOST} ^$ [OR]
RewriteCond %{HTTP
HOST} ^www.subdominio\$
RewriteRule ^(.*)$ "http:\/\/subdominio\$1" [R=301,L]

I am using in this case Apache in CentoS Linux.

And a another problem is my pages only are accessible with .php in final!
How can I fix it too?
  • Hi Nayra!

    First check Your DNS settings -> CNAME record.
    If isset CNAME && CNAME === "www" :)
    check httpd.conf or virtual_host.conf file if any

    Check following directives:

    Kind Regards

  • I assume that You need to change "DirectoryIndex" directive in httpd.conf file
    and add index.html there.

  • Please, can you explain me step-by-step? I am beginner, I don't have idea how to do it and where to do it!!!

    Help me please!!!

Be the first one to answer this question.