Announcement

Collapse
No announcement yet.

Mod Rewrite Friendly URLs => .htaccess

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment


    • #32
      Originally posted by Charlie_Brown View Post
      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 customization and demonstration site.
      vBulletin 5 Documentation - Updated every Friday. Report issues here.
      vBulletin 5 API - Full / Mobile
      I am not currently available for vB Messenger Chats.

      Comment


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

        Comment


        • #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
          
          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}
          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 16th Nov '09, 5:08pm.

          Comment


          • #35
            Works perfect for me... great work

            Comment


            • #36
              Works perfect for me Thank you very much!

              Comment


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

                Comment


                • #38
                  Originally posted by NavS View Post
                  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}
                  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


                  • #39
                    Curious. I noticed that the mod rewrite rules adds a /thread/ before the link, eg
                    http://forum.mysite.com/threads/6379-my-post-is-awesome

                    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 17th Nov '09, 6:14am.

                    Comment


                    • #40
                      so how would I get:

                      http://www.site.com/groups/group-name
                      I buy 420 forums

                      Comment


                      • #41
                        also I need this:
                        http://www.site.com/albums/album-name

                        Comment


                        • #42
                          Originally posted by Alfa1 View Post
                          Originally posted by Pehchaan View Post
                          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
                          http://www.site.com/albums/123-album-name
                          But vBulletin would still not actually link to it at all.

                          Comment


                          • #43
                            Originally posted by FF|Skyrider View Post
                            Curious. I noticed that the mod rewrite rules adds a /thread/ before the link, eg
                            http://forum.mysite.com/threads/6379-my-post-is-awesome

                            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 View Post
                            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


                            • #44
                              Worked perfect.

                              Originally posted by MattyAsia View Post
                              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


                              • #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...
                                X