Mod Rewrite Friendly URLs => .htaccess

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Veer
    Senior Member
    • Nov 2005
    • 124

    #16
    Working fine for me, thanks.

    Comment

    • omegatron
      Member
      • Mar 2004
      • 55

      #17
      That did not work for me but this does

      Code:
      RewriteEngine on
      Options +FollowSymLinks
      
      #RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
      #RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
      
      RewriteRule ^threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) showthread.php?t=$1&page=$2&%{QUERY_STRING}
      RewriteRule ^members/([0-9]+) member.php?u=$1&%{QUERY_STRING}
      RewriteRule ^forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) forumdisplay.php?f=$1&page=$2&%{QUERY_STRING}
      RewriteRule ^blogs/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) blog.php?u=$1&page=$2&%{QUERY_STRING}
      RewriteRule ^entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) entry.php?b=$1&page=$2&%{QUERY_STRING}
      RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING}
      RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}

      Comment

      • audiokid
        Senior Member
        • Apr 2009
        • 555
        • 4.1.x

        #18
        first rewrite works for me , thanks!

        which one is best?
        Cheers!

        RECORDING ORG
        created for musicians, by musicians

        Comment

        • smirkley
          Senior Member
          • Feb 2008
          • 525
          • 4.0.0

          #19
          First one gives 500 server error.

          Mod Rewrite is fully installed on my VPS.

          Looking for confirmation on second entry above before I bother trying.


          (really really wanting vB input on this, at least by next beta release)

          Comment

          • Charlie_Brown
            Senior Member
            • Dec 2006
            • 1275
            • 4.1.x

            #20
            Both give my 500 errors but that might be I am on a test forum that you have to log in to get to the forum first?

            Comment

            • snerd
              Member
              • Apr 2006
              • 91
              • 3.8.x

              #21
              Originally posted by smirkley
              First one gives 500 server error.

              Mod Rewrite is fully installed on my VPS.

              Looking for confirmation on second entry above before I bother trying.


              (really really wanting vB input on this, at least by next beta release)
              I got same 500 internal error with second one too.
              snerd

              Comment

              • kuyenmotdivad
                Senior Member
                • Apr 2006
                • 616
                • 4.1.x

                #22
                Both work for me fine.

                Comment

                • Zachery
                  Former vBulletin Support
                  • Jul 2002
                  • 59097

                  #23
                  Its possible your webhost does not allow you to use mod_rewrite rules.

                  Comment

                  • Darkimmortal
                    Senior Member
                    • Apr 2009
                    • 686
                    • 3.8.11

                    #24
                    Nginx rewrites:

                    Code:
                            rewrite entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) entry.php?b=$1&page=$2&$query_string;
                            rewrite threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) showthread.php?t=$1&page=$2&$query_string;
                            rewrite members/([0-9]+) member.php?u=$1&$query_string;
                            rewrite forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) forumdisplay.php?f=$1&page=$2&$query_string;
                            rewrite blogs/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) blog.php?u=$1&page=$2&$query_string;
                            rewrite list/([^/]*/)([0-9]+) list.php?r=$1$2&$query_string;
                            rewrite content/(.*) content.php?r=$1&$query_string;

                    Comment

                    • teamsport90
                      Senior Member
                      • Mar 2009
                      • 106
                      • 3.8.x

                      #25
                      OP code worked fine for me - thank you MattyAsia
                      Don't forget to thank your helpers by clicking on the http://www.vbulletin.com/forum/image...tation-40b.png icon in the post footer!

                      TeamSport90.com Grass Roots Football Forum
                      TeamSport90.com Football Kits

                      Comment

                      • baghdad4ever
                        Senior Member
                        • Apr 2007
                        • 587
                        • 4.1.x

                        #26
                        sorry nobe question

                        what should this code do? i apply it to my arabic forum and nothing occur

                        Comment

                        • Skyrider
                          Senior Member
                          • Feb 2006
                          • 540

                          #27
                          Originally posted by baghdad4ever
                          sorry nobe question

                          what should this code do? i apply it to my arabic forum and nothing occur
                          This code goes in combination with the SEO settings that enables Friendly URL's. You add the code that the thread creator created in your htaccess file located in the root of your forum files (if it isn't there, create one)

                          Comment

                          • testebr
                            Senior Member
                            • Feb 2005
                            • 228
                            • 3.6.x

                            #28
                            And about 301 redirectrules for old urls? We do not want to lose google ranking.

                            Comment

                            • Wayne Luke
                              vBulletin Technical Support Lead
                              • Aug 2000
                              • 74123

                              #29
                              I converted MattyAsia's .htaccess file to a web.config file that can be used for IIS 7 or higher and Microsoft's URL Rewrite module. However I have not had a chance to test it yet. You are welcome to test it.

                              Code:
                              <?xml version="1.0" encoding="UTF-8"?>
                              <configuration>
                                  <system.webServer>
                                      <rewrite>
                                          <rules>
                                              <rule name="Imported Rule 1">
                                                  <match url="^includes/(.*)" ignoreCase="false" />
                                                  <action type="Rewrite" url="index.php" />
                                              </rule>
                                              <rule name="Imported Rule 2">
                                                  <match url="^vb/(.*)" ignoreCase="false" />
                                                  <action type="Rewrite" url="index.php" />
                                              </rule>
                                              <rule name="Imported Rule 3">
                                                  <match url="^packages/(.*)" ignoreCase="false" />
                                                  <action type="Rewrite" url="index.php" />
                                              </rule>
                                              <rule name="Imported Rule 4">
                                                  <match url="^threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?))" ignoreCase="false" />
                                                  <action type="Rewrite" url="showthread.php?t={R:1}&amp;page={R:2}&amp;{QUERY_STRING}" appendQueryString="false" />
                                              </rule>
                                              <rule name="Imported Rule 5">
                                                  <match url="^members/([0-9]+)" ignoreCase="false" />
                                                  <action type="Rewrite" url="member.php?u={R:1}&amp;{QUERY_STRING}" appendQueryString="false" />
                                              </rule>
                                              <rule name="Imported Rule 6">
                                                  <match url="^forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?))" ignoreCase="false" />
                                                  <action type="Rewrite" url="forumdisplay.php?f={R:1}&amp;page={R:2}&amp;{QUERY_STRING}" appendQueryString="false" />
                                              </rule>
                                              <rule name="Imported Rule 7">
                                                  <match url="^blogs/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?))" ignoreCase="false" />
                                                  <action type="Rewrite" url="blog.php?u={R:1}&amp;page={R:2}&amp;{QUERY_STRING}" appendQueryString="false" />
                                              </rule>
                                              <rule name="Imported Rule 8">
                                                  <match url="^entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?))" ignoreCase="false" />
                                                  <action type="Rewrite" url="entry.php?b={R:1}&amp;page={R:2}&amp;{QUERY_STRING}" appendQueryString="false" />
                                              </rule>
                                              <rule name="Imported Rule 9">
                                                  <match url="^list/([^/]*/)([0-9]+)" ignoreCase="false" />
                                                  <action type="Rewrite" url="list.php?r={R:1}{R:2}&amp;{QUERY_STRING}" appendQueryString="false" />
                                              </rule>
                                              <rule name="Imported Rule 10">
                                                  <match url="^content/(.*)" ignoreCase="false" />
                                                  <action type="Rewrite" url="content.php?r={R:1}&amp;{QUERY_STRING}" appendQueryString="false" />
                                              </rule>
                                          </rules>
                                      </rewrite>
                                  </system.webServer>
                              </configuration>
                              Translations provided by Google.

                              Wayne Luke
                              The Rabid Badger - a vBulletin Cloud demonstration site.
                              vBulletin 5 API

                              Comment

                              • Darkimmortal
                                Senior Member
                                • Apr 2009
                                • 686
                                • 3.8.11

                                #30
                                Originally posted by testebr
                                And about 301 redirectrules for old urls? We do not want to lose google ranking.
                                I'm pretty sure vB handles that automatically.

                                Comment

                                Related Topics

                                Collapse

                                Working...