Announcement

Collapse
No announcement yet.

Mod Rewrite Friendly URLs => .htaccess

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

  • iettafune
    replied
    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

    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.

    why, when I delete a topic, i receive this error:

    Not Found

    The requested document was not found on this server.
    Web Server at site.it

    Leave a comment:


  • kristinprimal
    replied
    what I'd really like now is a way to remove the forum number in the friendly URL.

    i.e., right now it is showing:
    http://mydomain.com/forums/forum/1234-the-forum-title

    and I'd like it to just say:
    http://mydomain.com/forums/forum/the-forum-title

    Anyone know a way to do this? It doesn't have to be part of the product, if someone can tell me what .php file to change and where, and what to put in .htaccess, that would work for me too.

    thanks very much~

    Leave a comment:


  • Graex
    replied
    I had the issue with the "500 Internal Error" and none of the earlier .htaccess in this thread worked for me.

    However I found a .htaccess solution wich works very well for me from vbulletin.org

    Link: http://www.vbulletin.org/forum/showt...39#post1999837

    It seems to be made for Apache 1.3 (I'm not sure which version my host is using but it works!)

    Hope it helps someone.
    Last edited by Graex; Fri 26 Mar '10, 10:17pm. Reason: Accidently put the wrong link, fixed.

    Leave a comment:


  • burntire
    replied
    Originally posted by Bergler View Post
    Still having some issues and the error url is this http://www.mysite.com/forums/forums/...er-Information any ideas as to why it has forums in twice?
    Has anyone worked this out I have the forums/forums issue.

    Leave a comment:


  • zipperty
    replied
    Woiks great on my shared hosting - thanks

    Leave a comment:


  • obmob
    replied
    After enabling mod rewrite, is it normal that an old url is kept and not rewritten or redirected?

    I mean, I can access a url like this
    http://www.anizeen.com/showthread.php?t=22147

    Instead I'd expect it to look like this:
    http://www.anizeen.com/threads/22147...wing-tradition

    Am i wrong in my assupmtion? Or the rewrite rules only apply while browsing the site?

    Leave a comment:


  • RedFoxy
    replied
    ok I'm using now the official .htaccess and look all good...

    No one know how to explain at google which links I wanna show in google's sitelink?

    Leave a comment:


  • the_webmaster
    replied
    Originally posted by lifanovsky View Post
    Strange question. But did someone who turned on friendly URL's found that his or her forum started to be indexed more well with SE or did it help in some other way? I'm just thinking of turning this on and am not sure if its worth it...
    not strange at all.. I couldn't find out any benefit from using it. on other hand I lost my sub-forum indexing in Google search.

    might I'm wrong . but this is my point of view

    I'm still looking for how to get back my sub-forums back in google search result

    Leave a comment:


  • lifanovsky
    replied
    Strange question. But did someone who turned on friendly URL's found that his or her forum started to be indexed more well with SE or did it help in some other way? I'm just thinking of turning this on and am not sure if its worth it...

    Leave a comment:


  • RedFoxy
    replied
    the .htaccess that i found under do_not_upload\rewrite\apache2 is fully compatible with "Mod Rewrite Friendly URLs" option?

    I noticed that in that file there aren't nothing about list, content and widget/config is it normal?

    Leave a comment:


  • Zachery
    replied
    There have been full htaccess files provided for apache 2 and IIS since 4.0.1 I believe.

    Leave a comment:


  • diosrl
    replied
    So until this date, there's no official .htaccess file to use with the Mod Rewrite Friendly URLs option?

    Leave a comment:


  • RedFoxy
    replied
    Hi!
    I've a troubles with rewrite ("Mod Rewrite Friendly URLs" option) using \ in the title, the browser/server get it like a directory and give me a 404 error, I'm using that .htaccess:

    Code:
    RewriteEngine On
    Options +FollowSymLinks
    
    ####Charset
    AddDefaultCharset Off 
    
    ####Gzip
    <IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^(.*)(js|css)$ /redir.php?file=$1$2&type=$2 [L]
    </IfModule>
    
    ####ETags
    FileETag None
    
    #
    # Sitemap rewrite
    #
    
    RewriteRule ^((urllist|sitemap)_.*\.(xml|txt)(\.gz)?)$ /sitemapxml/vbulletin_sitemap_index.xml.gz [L]
    RewriteRule ^((urllist|sitemap)*\.(xml|txt)(\.gz)?)$ /sitemapxml/vbulletin_sitemap_index.xml.gz [L]
    
    
    ####Expires
    
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/gif A2592000
    ExpiresByType image/jpeg A2592000
    ExpiresByType image/png A2592000
    ExpiresByType application/x-shockwave-flash A2592000
    ExpiresByType text/css A2592000
    ExpiresByType application/x-javascript A2592000
    </IfModule>
    
    
    #
    # MediaWiki
    #
    RewriteRule ^SAM-Wiki/(.*)$ /samwiki/index.php?title=$1 [PT,L,QSA]
    RewriteRule ^SAM-Wiki/*$ /samwiki/index.php [L,QSA]
    RewriteRule ^/samwiki/*$ /samwiki/index.php [L,QSA]
    
    #
    # Forum and CMS
    #
    
    # Author: Matty Asia
    # Version 1.6
    # Downloaded from: http://www.vbulletin.com/forum/showthread.php?325798
    
    
    ### 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}
    Just for example, i created a new topic with title "test\test" and the url is http://www.softairmania.it/threads/138861-test/test?p=2170201#post2170201 and it's invalid because I got a 404 error page

    Any ideas how to fix that trouble?
    Last edited by RedFoxy; Thu 11 Mar '10, 5:25pm.

    Leave a comment:


  • AndyPH
    replied
    Hello

    This .htaccess file seems to work for my forum with one exception, due to our individual situation.

    Previously our forum files were all in the /forums folder. With the upgrade to VB4, we've moved it back to the root folder. To ensure that all the old links to threads, etc, remained intact, we put a rewrite rule in the .htaccess file to redirect from /forums back to root for all links.

    Not that I have added all of the text from MattyAsia's .htaccess file, there is a clash, as it rewrites links with forumdisplay.php to be forums/, which our other rule tries to direct to root. Doh!

    Does anyone have an idea on how I could fix this? Or should I just go back to Advanced Friendly URLS?

    Here's the code. The highlighted lines are where the conflict occurs.
    Code:
    RewriteEngine on
    
    
    
    # Author: Matty Asia
    # Version 1.6
    # Downloaded from: http://www.vbulletin.com/forum/showthread.php?325798
    
    RewriteEngine On
    Options +FollowSymLinks
    
    RewriteCond %{HTTP_HOST} ^xxxxxxxx.net$ [OR]
    RewriteCond %{HTTP_HOST} ^www.xxxxxxxx.net$
    [B][COLOR=Orange]RewriteRule ^forums\/?(.*)$ "http\:\/\/xxxxxxxx\.net\/$1" [R=301,L][/COLOR][/B]
    
    ### 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}
    [COLOR=Orange][B]RewriteRule ^forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) forumdisplay.php?f=$1&page=$2&%{QUERY_STRING}[/B][/COLOR]
    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 ^lists/([^/]*/)([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}
    Thank you
    Andy

    Leave a comment:


  • diogobguerreiro
    replied
    I used your .htaccess and it worked, but it happens that one thing missing. The accents are in the link.

    Example: www.forumdigitalfoto.com/forums/4-Câmeras-Reflex-Digitais-DSLR

    Instead of: www.forumdigitalfoto.com/forums/4-Cameras-Reflex-Digitais-DSLR

    How can I solve this problem?

    Leave a comment:

Related Topics

Collapse

Working...
X