Announcement

Collapse
No announcement yet.

Mod Rewrite Friendly URLs => .htaccess

Collapse
X
Collapse
  •  

  • Mod Rewrite Friendly URLs => .htaccess

    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

    Download: http://www.phpatlas.com/vBulletin/htaccess

    Code:
    # Author: Matty Asia
    # Version 1.6
    # Downloaded from: http://www.vbulletin.com/forum/showthread.php?325798
    
    RewriteEngine On
    Options +FollowSymLinks
    
    ### 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}
    RewriteRule ^widget/config/([0-9]+) widget.php?r=config/$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.6 Added ... Widget bit
    1.5 Added ... Options +FollowSymLinks
    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.

    Originally posted by snerd View Post
    Well, looks like it's getting munged and the line is not complete:

    RewriteRule: cannot compile regular expression '^threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?))'\n
    That '\n is appearing when I copy to the .htaccess for some reason.

    • Arasius
      #38
      Arasius commented
      Editing a comment
      I'm getting paggination issues on the board with this .htaccess an mod rewrite on. When I click a pagination number....it sends me to others forums.... Any clue?

    • CK
      #39
      CK commented
      Editing a comment
      Originally posted by Paul M
      They original fix I mentioned wont actually work correctly, ive updated the comment - the only true fix is to switch to the vb4 default rules.
      Originally posted by Arasius
      I'm getting paggination issues on the board with this .htaccess an mod rewrite on. When I click a pagination number....it sends me to others forums.... Any clue?

    • smirkley
      #40
      smirkley commented
      Editing a comment
      Originally posted by Paul M
      They original fix I mentioned wont actually work correctly, ive updated the comment - the only true fix is to switch to the vb4 default rules.
      I run Apache 1.3 and the "true fix" will not work. The default code in the bundle (A2) will just crash the server.

      But I can offer my modified rules to vB that seem to work perfectly on my A1.3v.

      Because there are still alot of 1.3 builds out there, I feel vB should bundle for that version also.

      (vB staff can pm me and I can send them what I am using if they wish to bundle a 1.3v solution also for their customers that need it, after vB tests and tweaks it for public consumption).)
      (I would just post the whole thing here, but it may not be perfect, universally functional, and most certainly unsupported by me)
    Posting comments is disabled.

About the Author

Collapse

MattyAsia Find out more about MattyAsia

Article Tags

Collapse

advanced (5) android (2) api (29) array (17) beginner (17) blog (4) calendar (2) cloud (1) cms (2) create (1) customization (1) database (1) forum (3) forums (4) Intermediate (7) iphone (3) mapi (30) methods (10) mobile (34) poll (1) security (2) style (2) threads (4) vb5howto (5) vBulletin (5)

Latest Articles

Collapse

  • Managing CMS Section and Content
    by Don Kuramura
    Here's a quick Visual Guide on how Manage Sections in the new CMS.

    1. Editing a Section: If you have permissions to manage a Section, as you hover over the Section title, a pencil icon will display.

    After clicking the pencil icon, you will be taken to the Section Edit page. Here's what you will see:

    2. Section Name:
    Enter the Section Name
    3. SEO URL Alias: This is the SEO Friendly URL. By default, if this is blank, the system will automatically copy the section title.
    4. Section Layout: For each section you can define an individual section layout.
    ...
    Tue 11th Mar '14, 3:04pm
  • How to Create a New Article
    by Don Kuramura
    Here's a quick visual guide on how to create a new article with the CMS.

    1. Create New Article Button: Navigate to the section you want the article to be published in. Click on the “Create a New Article” button. This will open an article form.


    2. Article Title: In the "Add/Edit Article" screen, enter the title of your article in the “Title” textbox.
    ...
    Tue 11th Mar '14, 3:04pm
  • Promoting Articles from the Forums
    by Don Kuramura
    One of the innovative new features on vBulletin 4.0 Publishing Suite is the cross-publishing "Promote to Article" functionality. In the spirit of promoting content discovery, we wanted to create features that will allow content to flow between Forums, Blogs, and Articles. For example, there might be a really popular post in the forums, but unfortunately it is buried inside page 13 of a thread. We will now have an option (if you have permissions) to “promote” a forum (or blog) post as a new artic...
    Tue 11th Mar '14, 3:04pm
  • Welcome to the new CMS. Read me first.
    by Don Kuramura
    Welcome to the new CMS. Here's a quick guide of the different areas of this page.

    1. Section Navigation Widget. This widget allows you to go to different sections. The "plus icon" means that this section has sub-sections. Clicking on the "plus icon" will display the sub-sections. ...
    Tue 11th Mar '14, 3:04pm
  • Recovering a hacked vBulletin Site
    by TheLastSuperman
    Symptoms

    Having your site hacked is something no owner wants to experience due to the fact it takes quite a bit of effort to fix, often times requiring payment to a experienced third-party when a owner feels inundated by the sheer amount of work required to troubleshoot and remedy the situation.
    • Site has been defaced - This is the most blatant form of hacking where your sites pages have been replaced with a very disruptive and sometimes rude message from the hacker themselves.
    ...
    Tue 12th Jun '12, 2:37am
  • Issues After Upgrading
    by TheLastSuperman
    If your running a completely default forum upgrading is a very simple process. Many sites however run third-party add-ons and even use a custom style therefor when things change between older and newer
    Thu 24th May '12, 1:02pm
Working...
X