Version 3

FeaturePrettyUrlsExtended

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

Created by: KainX, Last modification: 21 Dec 2005 (17:44 UTC) by KainX
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

        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/([A-Za-z0-9_]+)$                              /users/index.php?home=$1 [L,QSA]
        RewriteRule ^/users/view/([A-Za-z0-9_]+)$                         /users/index.php?home=$1 [L,QSA]
        RewriteRule ^/wiki/view/(.*)$                                     /wiki/index.php?page=$1  [L]
        RewriteRule ^/articles/([0-9]+)$                                  /articles/read.php?article_id=$1  [L]
        RewriteRule ^/blogs/([0-9]+)$                                  /blogs/view.php?blog_id=$1  [L]
        RewriteRule ^/blogs/post/([0-9]+)$                             /blogs/view_post.php?post_id=$1  [L]

        RewriteCond %{SCRIPT_FILENAME}  -f [OR]
        RewriteCond %{SCRIPT_FILENAME}/index.php    -f
        RewriteRule ^/wiki/(.*)$            - [L]
        RewriteRule ^/wiki/(.*)$  /wiki/index.php?page=$1  [L]

        RewriteCond %{SCRIPT_FILENAME}  -f [OR]
        RewriteCond %{SCRIPT_FILENAME}/index.php    -f
        RewriteRule ^/pigeonholes/(.*)$            - [L]
        RewriteRule ^/pigeonholes/(.*)$  /pigeonholes/index.php?content_id=$1  [L]
</IfModule>


See Also



Page History
Date/CommentUserIPVersion
30 Jun 2008 (09:17 UTC)
Kozuch85.207.244.1605
Current • Source
KainX12.203.189.343
View • Compare • Difference • Source
James Thompson64.65.89.2272
View • Compare • Difference • Source