0
Welcome Guest! Login
0 items Join Now

ROCKETTHEME IS CLOSING ON JUNE 30, 2025. As a thank-you to our community, enjoy 50% off all themes with the promo code THANKYOU before we shut down. Read our Farewell Blog Post for more details.

How can I get index.php to go to index.html with out using a

  • How can I get index.php to go to index.html with out using a

    Posted 16 years 4 months ago
    • Franck's Avatar
    • Franck
    • Elite Rocketeer
    • Posts: 1049
    • Thanks: 0

    Re: How can I get index.php to go to index.html with out using a

    Posted 16 years 4 months ago
  • Re: How can I get index.php to go to index.html with out using a

    Posted 16 years 4 months ago
    • Hi Franck,

      I have would like to be able to remove the .php on the index. The whole site shows .html but the index runs as a .html. I would like to have bots index the site as a html BUT when you type the domain I want it to come up as " www.domain.com " and only if you type index.html to would also show as the home page.

      Thanks Franck
    • Franck's Avatar
    • Franck
    • Elite Rocketeer
    • Posts: 1049
    • Thanks: 0

    Re: How can I get index.php to go to index.html with out using a

    Posted 16 years 4 months ago
    • OK, I understand now. I don't know how to change the .php into .html but if you set correctly a 301 redirect in your .htaccess you will always have www.yourdomain.com and not www.yourdomain.com/index.php and the benefit is to avoid duplicate content.

      add this code in .htaccess and don't forget to put your domain name.
      # Redirect requests to index.php
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
      RewriteRule ^index\.php$ http://www.yourdomain.com/ [R=301,L]

      Hope this help.
  • Re: How can I get index.php to go to index.html with out using a

    Posted 16 years 4 months ago
    • Hi Franck,

      Thank you I think I understand, this is what my htaccess file looks like for:
      ########## Begin - Joomla! core SEF Section
      #
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/index.php
      RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
      RewriteRule (.*) index.php
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
      #
      ########## End - Joomla! core SEF Section

      Are you saying I but your code in so it would look like this:
      ########## Begin - Joomla! core SEF Section
      #
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/index.php
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
      RewriteRule ^index\.php$ www.yourdomain.com/ [R=301,L]
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
      #
      ########## End - Joomla! core SEF Section

      Thanks Danny
    • Franck's Avatar
    • Franck
    • Elite Rocketeer
    • Posts: 1049
    • Thanks: 0

    Re: How can I get index.php to go to index.html with out using a

    Posted 16 years 4 months ago
    • Hi Danny,

      You don't need to put the code into the SEF part of your .htaccess, just insert the code before and it should work fine:
      # Redirect requests to index.php
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
      RewriteRule ^index\.php$ http://www.yourdomain.com/ [R=301,L]
       
      ########## Begin - Joomla! core SEF Section
      #
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/index.php
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
      #
      ########## End - Joomla! core SEF Section
  • Re: How can I get index.php to go to index.html with out using a

    Posted 16 years 4 months ago
    • Hi Franck,

      Can I ask what the difference is between the below:

      # Redirect requests to index.php
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
      RewriteRule ^index\.php$ www.yourdomain.com/ [R=301,L]

      VS

      Redirect 301 "/index.html" http://www. yourdomain.com/index.php

      Thanks

      Danny
    • Franck's Avatar
    • Franck
    • Elite Rocketeer
    • Posts: 1049
    • Thanks: 0

    Re: How can I get index.php to go to index.html with out using a

    Posted 16 years 4 months ago
  • Re: How can I get index.php to go to index.html with out using a

    Posted 16 years 4 months ago
    • Hi Franck,

      The thing is the old site had a index page which was a .html and Google webmaster is say there is 64 links to the index.html.

      Thanks Danny
    • Franck's Avatar
    • Franck
    • Elite Rocketeer
    • Posts: 1049
    • Thanks: 0

    Re: How can I get index.php to go to index.html with out using a

    Posted 16 years 4 months ago
    • So, you can try to add the code twice in your .htaccess (I never tried before but should work) like this:
      # Redirect requests to index.html
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
      RewriteRule ^index\.html$ http://www.yourdomain.com/ [R=301,L]
       
      # Redirect requests to index.php
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
      RewriteRule ^index\.php$ http://www.yourdomain.com/ [R=301,L]

      Another solution is to find all broken links to index.html and remove all of them

      You can use Xenu free :software to do this job:

      home.snafu.de/tilman/xenulink.html

Time to create page: 0.075 seconds