Announcement

Collapse
No announcement yet.

Mod Rewrite Friendly URLs => .htaccess

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

  • MattyAsia
    replied
    Originally posted by gotski View Post
    It doesn't work for me ;(
    Did you set vBulletin to use "Mod Rewrite Friendly URLs"?
    You need to go to Admin Control Panel then Settings > Options
    Help
    Server Settings and Optimization Options
    Then select Mod Rewrite Friendly URLs in the Friendly URLs section.

    Leave a comment:


  • gotski
    replied
    It doesn't work for me ;(

    Leave a comment:


  • MattyAsia
    started a topic Mod Rewrite Friendly URLs => .htaccess

    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.
    Last edited by MattyAsia; Tue 8 Dec '09, 12:31pm.

Related Topics

Collapse

Working...
X