how do i redirect site.com/forum/index.php to site.com/forum/

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • luke101
    Member
    • Feb 2006
    • 50
    • 3.5.x

    how do i redirect site.com/forum/index.php to site.com/forum/

    I have seen this done on many sites and not sure how to do it.

    here is my forum
    www.incomehunting.com/forum/

    whenever someone types
    www.incomehunting.com/forum/index.php

    I want it to redirect to
    www.incomehunting.com/forum/

    I need this done for SEO purposes

    Here is my .htaccess file

    Code:
     
    <Ifmodule mod_rewrite.c> 
    rewriteEngine on 
    rewriteCond %{HTTP_HOST} .
    rewriteCond %{HTTP_HOST} !^www\.incomehunting\.com 
    rewriteRule (.*) [URL="http://www.incomehunting.com/$1"]http://www.incomehunting.com/$1[/URL] [R=301,L]
    </Ifmodule>
    Higher Yielding Investments
  • GandalfDDUK
    New Member
    • Nov 2004
    • 18

    #2
    In your htaccess file put the following;

    Options +FollowSymLinks
    RewriteEngine on
    # index.php to /
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
    RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
    Last edited by GandalfDDUK; Sat 6 May '06, 4:44pm.

    Comment

    • luke101
      Member
      • Feb 2006
      • 50
      • 3.5.x

      #3
      well i dont want it to show .htm, .html .php or none of those

      If someone types in www.site.com/index.htm
      I want it to redirct to www.site.com/

      I dont want it to show extensions.. and the same I need for the forum

      If someone types www.site.com/forum/index.php
      I want it to redirect to www.site.com/forum/

      Can this be done?
      Higher Yielding Investments

      Comment

      • luke101
        Member
        • Feb 2006
        • 50
        • 3.5.x

        #4
        hmmm..i am puzzled..still does not work

        here is my code:
        Code:
         
        <Ifmodule mod_rewrite.c>
        Options +FollowSymLinks
        rewriteEngine on
        # index.php to /
        RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
        rewriteCond %{HTTP_HOST} .
        rewriteCond %{HTTP_HOST} !^www\.incomehunting\.com
        RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
        rewriteRule (.*) [URL="http://www.incomehunting.com/$1"]http://www.incomehunting.com/$1[/URL] [R=301,L]
        </Ifmodule>
        Higher Yielding Investments

        Comment

        • luke101
          Member
          • Feb 2006
          • 50
          • 3.5.x

          #5
          any ideas
          Higher Yielding Investments

          Comment

          • SaN-DeeP
            Senior Member
            • Dec 2003
            • 1352
            • 1.1.x

            #6
            try to change as follows:
            Code:
            <Ifmodule mod_rewrite.c>
            Options +Indexes +FollowSymlinks 
            RewriteEngine on 
            RewriteBase / 
            ### 
            ### re-direct sites index.htm to site root ###
            RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.htm\ HTTP/
            RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
            ###old .htaccess codes###
            rewriteCond %{HTTP_HOST} .
            rewriteCond %{HTTP_HOST} !^www\.incomehunting\.com 
            rewriteRule (.*) http://www.incomehunting.com/$1 [R=301,L]
            ####
            </Ifmodule>
            put this in your site root folder .htaccess file
            TechArena - TechArena Community - Technology News - Tools Download - Tech Video - Gamer Guide - Hardware Review

            Comment

            • SaN-DeeP
              Senior Member
              • Dec 2003
              • 1352
              • 1.1.x

              #7
              create a new .htaccess file in your forum folder with following content:

              Code:
              <Ifmodule mod_rewrite.c>
              Options +Indexes +FollowSymlinks 
              RewriteEngine on 
              RewriteBase / 
              ### 
              ### re-direct forum index.php to forum root ###
              RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
              RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
              ####
              </Ifmodule>
              TechArena - TechArena Community - Technology News - Tools Download - Tech Video - Gamer Guide - Hardware Review

              Comment

              • luke101
                Member
                • Feb 2006
                • 50
                • 3.5.x

                #8
                Hmm..I tried both code and it still seems not to work here is the code i have

                In root:
                Code:
                 
                <Ifmodule mod_rewrite.c>
                Options +Indexes +FollowSymlinks 
                RewriteEngine on 
                RewriteBase / 
                ### 
                ### re-direct sites index.htm to site root ###
                RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.htm\ HTTP/
                RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
                ###old .htaccess codes###
                rewriteCond %{HTTP_HOST} .
                rewriteCond %{HTTP_HOST} !^www\.incomehunting\.com 
                rewriteRule (.*) [URL="http://www.incomehunting.com/$1"]http://www.incomehunting.com/$1[/URL] [R=301,L]
                ####
                </Ifmodule>
                In forum folder:
                <Ifmodule mod_rewrite.c>
                Options +Indexes +FollowSymlinks
                RewriteEngine on
                RewriteBase /
                ###
                ### re-direct forum index.php to forum root ###
                RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
                RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
                ####
                </Ifmodule>
                let me know if have ideas
                Higher Yielding Investments

                Comment

                • SaN-DeeP
                  Senior Member
                  • Dec 2003
                  • 1352
                  • 1.1.x

                  #9
                  change the roor .htaccess file as follows:
                  Code:
                  <Ifmodule mod_rewrite.c>
                  Options +Indexes +FollowSymlinks 
                  RewriteEngine on 
                  RewriteBase / 
                  ### 
                  ### re-direct sites index.htm to site root ###
                  RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.htm\ HTTP/
                  RewriteRule ^(.*)index\.[B]htm[/B]$ /$1 [R=301,L]
                  ###old .htaccess codes###
                  rewriteCond %{HTTP_HOST} .
                  rewriteCond %{HTTP_HOST} !^www\.incomehunting\.com 
                  rewriteRule (.*) http://www.incomehunting.com/$1 [R=301,L]
                  ####
                  </Ifmodule>
                  this definely works.
                  http://forums.techarena.in/index.php re-directs properly to http://forums.techarena.in

                  you can confirm your changes here: http://www.webconfs.com/redirect-check.php
                  TechArena - TechArena Community - Technology News - Tools Download - Tech Video - Gamer Guide - Hardware Review

                  Comment

                  • luke101
                    Member
                    • Feb 2006
                    • 50
                    • 3.5.x

                    #10
                    hey man you are a genious...I see i need to practice my seo skills..

                    Where can I find more info on this kind of stuff..I have alot to learn..
                    Higher Yielding Investments

                    Comment

                    • luke101
                      Member
                      • Feb 2006
                      • 50
                      • 3.5.x

                      #11
                      OH..and also can I do the same for the forum? I tried putting php where the htm was but the forum part seem to not work.
                      Higher Yielding Investments

                      Comment

                      • SaN-DeeP
                        Senior Member
                        • Dec 2003
                        • 1352
                        • 1.1.x

                        #12
                        are you using the exact code posted in:

                        ?

                        make sure even a change in . or any other signs will give you incorrect results.
                        TechArena - TechArena Community - Technology News - Tools Download - Tech Video - Gamer Guide - Hardware Review

                        Comment

                        • luke101
                          Member
                          • Feb 2006
                          • 50
                          • 3.5.x

                          #13
                          OK, here is the file I am putting in the forum folder. I have given it read and execute privileges and I took the .txt ext off. Is there anything else I need to do? Also, here is the code I am using

                          Code:
                           
                          <Ifmodule mod_rewrite.c>
                          Options +Indexes +FollowSymlinks
                          RewriteEngine on
                          RewriteBase /
                          ###
                          ### re-direct forum index.php to forum root ###
                          RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
                          RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
                          ####
                          </Ifmodule>
                          Attached Files
                          Higher Yielding Investments

                          Comment

                          • luke101
                            Member
                            • Feb 2006
                            • 50
                            • 3.5.x

                            #14
                            do you guys think I should make a sub domain?

                            Would it work then?
                            Higher Yielding Investments

                            Comment

                            • SaN-DeeP
                              Senior Member
                              • Dec 2003
                              • 1352
                              • 1.1.x

                              #15
                              Originally posted by luke101
                              do you guys think I should make a sub domain?

                              Would it work then?
                              nope you do not need to create a subdomain here, its quite strange above codes work proper for your site root but not for forums...
                              TechArena - TechArena Community - Technology News - Tools Download - Tech Video - Gamer Guide - Hardware Review

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...