login | register
Fri 09 of Jan, 2009 (23:02 UTC)

bitweaver - Web Application Framework and CMS

Web Application Framework and CMS

Refresh cacheHistoryPrint

FeaturePrettyUrlsExtended

Use of URL rewriting (mod_rewrite) to generate cleaner site URL's

Created by: James Thompson, Last modification: Mon 30 of Jun, 2008 (09:17 UTC) by Kozuch
This feature is an extension of PrettyUrls. It adds an extra tag into the URLs to make them unambigious. Some links generated by PrettyUrls may not function as expected. For example, a link to the user page for the user 'admin' will not display correctly when PrettyUrls is enabled.

For User and Wiki links, this feature adds a '/view' tag into the generated URLs.

Normal URL:
http://www.bitweaver.org/wiki/index.php?page=LDAPCompatibility


When PrettyUrls is enabled:
http://www.bitweaver.org/wiki/LDAPCompatibility


When FeaturePrettyUrlsExtended is enabled:
http://www.bitweaver.org/wiki/view/LDAPCompatibility


Enabling this feature will require manually editing the default .htaccess files.

The exact changes will depend on your web server configuration.

Example for wiki/.htaccess
<IfModule mod_rewrite.c>
        RewriteEngine  on
        RewriteBase /wiki/
        RewriteCond %{SCRIPT_FILENAME}        -f [OR]
        RewriteCond %{SCRIPT_FILENAME}/index.php        -f
        RewriteRule ^(.*)$        - [L]
        RewriteRule view/(.*)$        index.php?page=$1  [L]
</IfModule>


Or, you can incorporate all the necessary rewrites into your main Apache configuration:
<IfModule mod_rewrite.c>
        RewriteEngine  on
        #RewriteLog /var/log/httpd/rewrite.log
        #RewriteLogLevel 2
 
        # If the URL points to a file that exists, don't rewrite.
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}            -f [OR]
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index.php  -f [OR]
        RewriteCond %{REQUEST_FILENAME}                            -f [OR]
        RewriteCond %{REQUEST_FILENAME}/index.php                  -f
        RewriteRule ^.*$                                           - [L]
 
        RewriteRule ^/fisheye/image/([0-9]+)(/[0-9/]+)*/?([A-Za-z]+)*$    /fisheye/view_image.php?image_id=$1&gallery_path=$2&size=$3  [L,QSA]
        RewriteRule ^/fisheye/gallery([0-9/]+)*/([0-9]+)/?$               /fisheye/view.php?gallery_id=$2&gallery_path=$1  [L,QSA]
        RewriteRule ^/users/view/([A-Za-z0-9_]+.*)$                       /users/index.php?home=$1 [L,QSA]
        RewriteRule ^/users/([A-Za-z0-9_]+.*)$                            /users/index.php?home=$1 [L,QSA]
        RewriteRule ^/wiki/view/(.+)$                                     /wiki/index.php?page=$1  [L]
        RewriteRule ^/wiki/(.+)$                                          /wiki/index.php?page=$1  [L]
        RewriteRule ^/articles/([0-9]+.*)$                                /articles/read.php?article_id=$1  [L]
        RewriteRule ^/blogs/view/content/([0-9]+.*)$                      /blogs/view_post.php?content_id=$1  [L]
        RewriteRule ^/blogs/post/([0-9]+.*)$                              /blogs/view_post.php?post_id=$1  [L]
        RewriteRule ^/blogs/([0-9]+.*)$                                   /blogs/view.php?blog_id=$1  [L]
        RewriteRule ^/pigeonholes/(.+)$                                   /pigeonholes/index.php?content_id=$1  [L]
 
        # Defend against possible future exploits: http://www.phpbb.com/phpBB/viewtopic.php?t=308605 and http://www.phpbb.com/phpBB/viewtopic.php?p=1368328#1368328
        RewriteCond %{QUERY_STRING} ^(.*)\.printf\(        [OR]
        RewriteCond %{QUERY_STRING} ^(.*)wget\%20          [OR]
        RewriteCond %{QUERY_STRING} ^(.*)echr(.*)          [OR]
        RewriteCond %{QUERY_STRING} ^(.*)esystem(.*)       [OR]
        RewriteCond %{QUERY_STRING} ^(.*)highlight=\%2527  [OR]
        RewriteCond %{QUERY_STRING} ^(.*)highlight='       [OR]
        RewriteCond %{HTTP_COOKIE}% s:(.*):\%22test1\%22\%3b
        RewriteRule ^.*$ http://127.0.0.1/ [L,F]
 
        RewriteCond %{HTTP_REFERER} (texas\-hold\-em|e\-site|viagra|casino|poker|holdem|pharmacy|e\-buy|cialis|pills)(.*)\.(com|net|org|us|info|biz)   [NC,OR]
        RewriteCond %{HTTP_REFERER} \.(com|net|org|us|info|biz)\/(online\-poker|texas-holdem|poker|empire\-poker|poker\-rooms)\.html$     [NC,OR]
        RewriteCond %{HTTP_REFERER} ^http://www.andrewsaluk.com/.*$  [NC,OR]
        RewriteCond %{HTTP_REFERER} \.(com|net|org|us|info|biz)\/.*(equity|mortgage|consolidation|loan).*\.html$  [NC]
        RewriteRule ^.*$ http://127.0.0.1/ [L,F]
 
        # fake out phpBB user profile page
        RewriteCond %{REQUEST_URI} profile.php
        RewriteCond %{QUERY_STRING} .*mode=viewprofile.*u=([0-9]*)
        RewriteRule .*  /users/index.php?fHomepage=%1 [R,env=VV_THEME:people,QSA]
</IfModule> 


See Also




Comments

Reply to this comment

Debt counseling

by Christian Debt Solutions, Monday 18 of August, 2008 (04:32:42 UTC)
Debt counseling for Christian is nothing but managing you budget. A good number of organizations relative to debt management can be found but no one is going to help you but providing information. You have to help yourself that’s it. http://www.christiansdebtcounseling.com/

Related Items

Features

BitTabs  •  Bitweaver Features  •  FeaturePrettyUrlsExtended  •  HTMLPurifier Filter Options  •  ImageMagick  •  Inline Diff  •  ModuleParameters  •  PrettyUrls  •  StyleLayouts  •  StyleVariations

Online Help

These pages are linked from within bitweaver's administration

Attachment Tracker Filter  •  AuthenticationPluginMultisites  •  AuthenticationPlugins  •  bitweaverSyntax  •  DataPluginAddtabs  •  DataPluginAdsense  •  DataPluginAgentInfo  •  DataPluginArticle  •  DataPluginArticles  •  DataPluginAttachment  •  DataPluginAvatar  •  DataPluginBackLinks  •  DataPluginBiticon  •  DataPluginBlog  •  DataPluginCalendar  •  DataPluginClock  •  DataPluginCode  •  DataPluginComment  •  DataPluginCountDown  •  DataPluginCreationTime  •  DataPluginDiv  •  DataPluginDropDown  •  DataPluginExample  •  DataPluginGauge  •  DataPluginGeshiData  •  DataPluginHitCounter  •  DataPluginImage  •  DataPluginImg  •  DataPluginInclude  •  DataPluginLang  •  DataPluginLedgertable  •  DataPluginLibrary  •  DataPluginMakeTOC  •  DataPluginMapQuest  •  DataPluginMapQuestDirections  •  DataPluginModule  •  DataPluginObject  •  DataPluginPluginHelp  •  DataPluginQuote  •  DataPluginRenderer  •  DataPlugins  •  DataPluginSF  •  DataPluginSort  •  DataPluginSourceForge  •  DataPluginspan  •  DataPluginSplit  •  DataPluginSpyText  •  DataPluginTitleSearch  •  DataPluginTOC  •  DataPluginTranslated  •  DataPluginUserCount  •  DataPluginUserLink  •  DataPluginUserList  •  DataPluginWikiList  •  DataPluginYoutube  •  FeaturePrettyUrlsExtended  •  HTMLPurifier  •  HTMLSyntax  •  IconStyles  •  Inline Diff  •  LibertyMime  •  LibertyMime FLV Plugin  •  List of Plugins  •  ModuleParameters  •  Plugin Help Pages Source  •  PrettyUrls  •  Simple Purifier  •  StyleLayouts  •  Style Purifier  •  TikiWikiSyntax  •  TranslationTutorial