0
Welcome Guest! Login
0 items Join Now

Force www and remove index.php

  • Force www and remove index.php

    Posted 12 years 2 months ago
    • We are trying to force "www." on our domain with .htaccess. When we use the following code, the www is forced and works but we receive a index.php after our domain (just on our home domain). We are using sh404sef so any clicks after that works fine and index.php is removed.
      RewriteEngine On
      RewriteCond %{HTTP_HOST} ^example.com [nc]
      RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc]
       
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
       
      RewriteCond %{THE_REQUEST} ^.*\/index\ HTTP/
      RewriteRule ^(.*)index\.php$ http://www.example.com/$1 [R=301,L]

      Is this the right code to use for .htaccess?
    • DanG's Avatar
    • DanG
    • Preeminent Rocketeer
    • Posts: 36750
    • Thanks: 3229
    • Custom work done

    Re: Force www and remove index.php

    Posted 12 years 2 months ago
  • Re: Force www and remove index.php

    Posted 12 years 2 months ago
    • This seemed to work. Thanks DanG!

Time to create page: 0.050 seconds