some issues with removing www and redirecting index.html

Posted by MariaKeys on Server Fault See other posts from Server Fault or by MariaKeys
Published on 2010-10-17T14:20:02Z Indexed on 2010/12/26 15:55 UTC
Read the original article Hit count: 201

Filed under:
|

Hello Fellas,

I am having trouble doing what i want to do with the following setup.

I would like to remove all WWW, and also forward index.html to root dir. I would like this to be for all domains, so i am doing inside httpd.conf directory directive.

I tried many variations with no success. Latest version is below (domains are inside /var/www/html, in seperate directories).

http://www.example.com/index.html > http://example.com 
http://www.example.com/someother/index.html > http://example.com/someother/

Thanks,

Maria

<Directory "/var/www/html/*/"> 
    RewriteEngine on 
    RewriteBase /  

    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]  
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]   

    #RewriteCond %{REQUEST_URI} /^index\.html/        
    RewriteRule ^(.*)index\.html$ / [R=301,L] 


        Options ExecCGI Includes FollowSymLinks 
        AllowOverride AuthConfig 
        AllowOverride All                       
        Order allow,deny 
        Allow from all 

 </Directory>    

© Server Fault or respective owner

Related posts about apache

Related posts about mod-rewrite