Mod Rewrite Friendly URLs => .htaccess

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charlie_Brown
    Senior Member
    • Dec 2006
    • 1275
    • 4.1.x

    #31
    Wayne would that go into the .htaccess file?

    Comment

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

      #32
      Originally posted by Charlie_Brown
      Wayne would that go into the .htaccess file?
      That would go into your web.config file if you're using IIS 7 or higher.
      Translations provided by Google.

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

      Comment

      • IanR
        New Member
        • Mar 2004
        • 23
        • 3.8.x

        #33
        Works a treat for me, thanks a lot!

        Comment

        • NavS
          New Member
          • Apr 2007
          • 24

          #34
          Code:
          # Author: Matty Asia
          # Version 1.4
          # Downloaded from: http://www.vbulletin.com/forum/showthread.php?325798
          
          RewriteEngine On
          
          ### THIS IS A LITTLE EXTRA SECURITY AND CAN BE REMOVED
          
          RewriteRule ^includes/(.*) index.php
          RewriteRule ^vb/(.*) index.php
          RewriteRule ^packages/(.*) index.php
          
          ### THIS IS THE ACTUAL REWRITE
          [COLOR=Red]
          RewriteRule ^threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) showthread.php?t=$1&page=$2&%{QUERY_STRING}[/COLOR] 
          RewriteRule ^members/([0-9]+) member.php?u=$1&%{QUERY_STRING}
          [COLOR=Red]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}[/COLOR]
          RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING}
          RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}
          adding any one of those breaks the whole website for me.

          i searched and this works for me now:

          Code:
          RewriteEngine On
          RewriteRule ^members/([0-9]+) member.php?u=$1&%{QUERY_STRING}
          RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING}
          RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}
          RewriteRule ^threads/([0-9]+)-(.*)? showthread.php?t=$1 [QSA,L]
          RewriteRule ^members/([0-9]+)-(.*)? member.php?u=$1 [QSA,L]
          RewriteRule ^forums/([0-9]+)-(.*)? forumdisplay.php?f=$1 [QSA,L]
          Last edited by NavS; Mon 16 Nov '09, 5:08pm.

          Comment

          • lucky89
            Senior Member
            • Oct 2006
            • 135
            • 4.2.X

            #35
            Works perfect for me... great work

            Comment

            • Mandar Salvi
              Senior Member
              • Oct 2009
              • 100
              • 3.8.x

              #36
              Works perfect for me Thank you very much!

              Comment

              • Veer
                Senior Member
                • Nov 2005
                • 124

                #37
                Can we also have friendly urls for social groups and albums?

                Comment

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

                  #38
                  Originally posted by NavS
                  Code:
                  # Author: Matty Asia
                  # Version 1.4
                  # Downloaded from: http://www.vbulletin.com/forum/showthread.php?325798
                  
                  RewriteEngine On
                  
                  ### THIS IS A LITTLE EXTRA SECURITY AND CAN BE REMOVED
                  
                  RewriteRule ^includes/(.*) index.php
                  RewriteRule ^vb/(.*) index.php
                  RewriteRule ^packages/(.*) index.php
                  
                  ### THIS IS THE ACTUAL REWRITE
                  [COLOR=Red]
                  RewriteRule ^threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) showthread.php?t=$1&page=$2&%{QUERY_STRING}[/COLOR] 
                  RewriteRule ^members/([0-9]+) member.php?u=$1&%{QUERY_STRING}
                  [COLOR=Red]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}[/COLOR]
                  RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING}
                  RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}
                  adding any one of those breaks the whole website for me.

                  i searched and this works for me now:

                  Code:
                  RewriteEngine On
                  RewriteRule ^members/([0-9]+) member.php?u=$1&%{QUERY_STRING}
                  RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING}
                  RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}
                  RewriteRule ^threads/([0-9]+)-(.*)? showthread.php?t=$1 [QSA,L]
                  RewriteRule ^members/([0-9]+)-(.*)? member.php?u=$1 [QSA,L]
                  RewriteRule ^forums/([0-9]+)-(.*)? forumdisplay.php?f=$1 [QSA,L]
                  Thanks, this works for me also.
                  snerd

                  Comment

                  • Skyrider
                    Senior Member
                    • Feb 2006
                    • 540

                    #39
                    Curious. I noticed that the mod rewrite rules adds a /thread/ before the link, eg


                    Is it possible it can be changed to something like this?
                    http://forum.mysite.com/my-post-is-awesome-t6379.html

                    I like that one much better.

                    EDIT!
                    At the post creator. Using that mod rewrite rules makes you unable to create front page articles. It brings you back to the front page with the link of creating a new article.
                    Last edited by Skyrider; Tue 17 Nov '09, 6:14am.

                    Comment

                    • Alfa1
                      Senior Member
                      • Dec 2005
                      • 4165
                      • 3.8.x

                      #40
                      so how would I get:

                      I buy 420 forums

                      Comment

                      • Veer
                        Senior Member
                        • Nov 2005
                        • 124

                        #41
                        also I need this:

                        Comment

                        • MattyAsia
                          Senior Member
                          • Aug 2009
                          • 104

                          #42
                          Originally posted by Alfa1
                          Originally posted by Pehchaan
                          It seems neither of these 2 actually support it. Writing the Rewrite is only a small part of the battle. I could write something that would do things like

                          But vBulletin would still not actually link to it at all.

                          Comment

                          • MattyAsia
                            Senior Member
                            • Aug 2009
                            • 104

                            #43
                            Originally posted by FF|Skyrider
                            Curious. I noticed that the mod rewrite rules adds a /thread/ before the link, eg


                            Is it possible it can be changed to something like this?
                            http://forum.mysite.com/my-post-is-awesome-t6379.html

                            I like that one much better.
                            Not possible through rewrites, I mean I could make it read from something like that... in theory, however, I you'd need to change vBulletin too to open it in such a fashion, way too much work. If your goal is just to make "http://forum.mysite.com/my-post-is-awesome-t6379.html" go to "http://forum.mysite.com/threads/6379-my-post-is-awesome" because of something like vbSEO, that's possible and not so hard.

                            Originally posted by FF|Skyrider
                            EDIT!
                            At the post creator. Using that mod rewrite rules makes you unable to create front page articles. It brings you back to the front page with the link of creating a new article.
                            Are you using the latest version I've written, check the number and see if it's v 1.4 (as written at the top of the file), it used to have that problem, but I fixed it.

                            Comment

                            • Lord Osirus
                              New Member
                              • Aug 2006
                              • 7
                              • 3.7.x

                              #44
                              Worked perfect.

                              Originally posted by MattyAsia
                              There is no .htaccess to support the "Mod Rewrite Friendly URLs", so I have one written below, the first 3 are just a little beta bug proofing.

                              I can not guarantee this is perfect, but it's working so far, if I find any bugs, I'll squish em and edit in an updated version

                              Code:
                              # Author: Matty Asia
                              # Version 1.4
                              # Downloaded from: http://www.vbulletin.com/forum/showthread.php?325798
                              
                              RewriteEngine On
                              
                              ### THIS IS A LITTLE EXTRA SECURITY AND CAN BE REMOVED
                              
                              RewriteRule ^includes/(.*) index.php
                              RewriteRule ^vb/(.*) index.php
                              RewriteRule ^packages/(.*) index.php
                              
                              ### THIS IS THE ACTUAL REWRITE
                              
                              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}
                              To use this you must have Mod Rewrite Friendly URLs enabled.

                              To do this...
                              You need to go to Admin Control Panel then Settings > Options
                              Server Settings and Optimization Options
                              Then select Mod Rewrite Friendly URLs in the Friendly URLs section.

                              UPDATES:
                              1.4 Fixed content editing for CMS sections without SEO friendly names

                              If you get Error 500, check the .htaccess file for any \n hidden anywhere as seems to have appeared for a number of users copying from here, see the quote just below. Make sure what you copy is identical to what you see above.

                              Comment

                              • Yves R.
                                vBulletin QA
                                • Nov 2003
                                • 3861
                                • 5.6.X

                                #45
                                You can add one more rule. This rule is for the 'Configure' link into the widget manager (admincp).

                                Code:
                                RewriteRule ^widget/config/([0-9]+) widget.php?r=config/$1&%{QUERY_STRING}
                                This works for me, it could help any other

                                vBulletin QA - vBulletin Support French - Lead Project Tools developer

                                Next release? Soon(tm)

                                Comment

                                Related Topics

                                Collapse

                                Working...