- VW4
- Rewrite Configuration
Return to current revision
Current Revision
June 19, 2017, 12:45 PM
General Differences
- changed the meta description
-
-
When installing VaultWiki for the first time, or upgrading to VaultWiki 4 from VaultWiki 3, or if you have made changes recently to Settings: Site Config, you may need to update your server's Rewrite configuration. If you are using default ... -
+
Rewrite rules allow a web server to take incoming requests to files and folders that may not physically exist on your server's file system and map them to scripts capable of handling those requests. With VaultWiki, you may need to update your serv...
-
Differences in Content
-
-
When installing VaultWiki for the first time, or upgrading to VaultWiki 4 from VaultWiki 3, or if you have made changes recently to [vw4]Settings: Site Config[/vw4], you may need to update your server's Rewrite configuration. If you are using default values for the following settings, you can skip this step: -
+
Rewrite rules allow a web server to take incoming requests to files and folders that may not physically exist on your server's file system and map them to scripts capable of handling those requests. With VaultWiki, you may need to update your server's Rewrite Configuration if:
[list][*]You have installed VaultWiki for the first time
[*]You have upgraded to VaultWiki 4 from VaultWiki 3
[*]You have installed a catch-all script after installing VaultWiki
[*]You have made changes recently to [vw4]Settings: Site Config[/vw4].[/list]
If you don't have any catch-all rewrite rules in place, and you are using default values for the following Site Config settings, you can usually skip this step: -
[list][*]Filename of the Wiki PHP File
[*]Wiki URL Format[/list] -
+
[template]Warning Box | Note | The Filename you choose for the Wiki PHP File should not be the name of another existing file, unless it is 'wiki_index' itself. If you are using a non-default setting for the Wiki URL Format, the Filename should not be the name of an existing directory. If the selected Filename matches a location on your server that already exists, it simply cannot point to the wiki too.[/template] -
Depending on what kind of software your web server uses, the configuration will vary.
-
-
[h=3]Apache[/h] -
+
[template]Warning Box | Exclusions | No rewrite configuration is needed in the following cases:
[list][*]You use XenForo, and Options > Search Engine Optimization (SEO) > Use Full Friendly URLs is enabled and working properly.[/list][/template]
[H="3"]Apache[/H] -
Locate the [i]/.htaccess[/i] file in your forum directory or create a new one.
Add the following to the file:
[code]RewriteEngine On
RewriteBase /
-
-
# If filename is not 'wiki_index', replace WIKI_FILE and uncomment the following line -
+
# If filename is not 'wiki_index', replace WIKI_FILE and uncomment the following line (skip this for XenForo) -
# RewriteRule ^WIKI_FILE.php wiki_index.php [L,QSA]
-
-
# If URL format is /wiki/path, uncomment the following 2 lines -
+
# If URL format is /wiki/path or replaces a catch-all rule, uncomment the following 3 lines and replace WIKI_FILE below (skip this for XenForo) -
# RewriteCond %{REQUEST_FILENAME} !-f -
-
# RewriteRule ^(.*)?$ wiki_index.php [L,QSA][/code] -
+
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^WIKI_FILE/?(.*)?$ wiki_index.php [L,QSA][/code] -
-
-
[h=3]NginX[/h] -
+
[H="3"]NginX[/H] -
Open your [i]/etc/nginx/nginx.conf[/i] file for editing, locate the server block for the domain where VaultWiki is installed, and add the following, where /forums/ is your forum directory: -
-
[code]location /forums/ { -
+
[code]
# If filename is not 'wiki_index', replace WIKI_FILE and uncomment the following 3 lines (skip this for XenForo)
#location ~ ^/forums/WIKI_FILE\.php$ {
# rewrite ^ /forums/wiki_index.php;
#}
# If URL format is NOT /wiki/path, do NOT include this block
location /forums/ { -
# for vBulletin, uncomment the following line -
-
# if ($request_filename != /(?:admincp|clientscript|cpstyles|install|images|modcp|cron|vbseo|vault))
# for XenForo, uncomment the following line
# if ($request_filename != /(?:admin|data|install|js|styles|vault)
{ -
+
# if ($request_filename !~ /(?:admincp|clientscript|cpstyles|install|images|modcp|cron|vbseo|vault)/)
# for XenForo, skip the next 4 lines
{ -
set $redirect_url $fastcgi_script_name;
rewrite ^ /forums/wiki_index.php last;
}
}[/code]
-
-
[template]Warning Box | Note | If you use vBSEO or some other method of catch-all URL rewriting, keep in mind that VaultWiki's rewrite rules should super-cede and completely replace the rules for your existing solution. You can pass URLs that VaultWiki fails to match to your catch-all script using the DEFAULT_SCRIPT directive in [i]/vault/config.php[/i].[/template] -
+
[H="3"]web.config[/H]
Open your [i]web.config[/i] file for editing, and add the following:
[code]<!-- VaultWiki rules start here -->
<!-- VaultWiki uninstall: Remove all lines until the 'VaultWiki rules end here' line -->
<!-- If filename is not 'wiki_index', replace WIKI_FILE and insert these lines -->
<rule name="VaultWiki unfriendly" stopProcessing="true">
<match url="^WIKI_FILE.php$" ignoreCase="false" />
<action type="Rewrite" url="wiki_index.php" appendQueryString="true" />
</rule>
<!-- / VaultWiki unfriendly -->
<!-- If URL format is /wiki/path or replaces a catch-all rule, insert these lines -->
<rule name="VaultWiki friendly" stopProcessing="true">
<match url="^(.*)?$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="wiki_index.php" appendQueryString="true" />
</rule>
<!-- / VaultWiki friendly -->
<!-- / VaultWiki rules end here -->[/code]
[H="3"]Note on Catch-All Rules (like vBSEO)[/H]
If you use vBSEO, dbSEO, or some other method of catch-all URL rewriting, keep in mind that VaultWiki's rewrite rules should super-cede and completely replace the rules for your existing solution.
If you do not do this, your wiki will be inaccessible and you will just get a "Configuration Error" all the time.
Using the vBSEO example, your [i].htaccess[/i] file might already contain something similar to the following:
[code]RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA][/code]
This block should be completely commented out or removed, since VaultWiki accomplishes the same thing.
Next you would locate a section that looks like this:
[code]RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap|api\.php)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA][/code]
Then, in the part of the line that ends like so:
[code]|api\.php)[/code]
you want to add more information right before the closing parenthesis. Usually, the following will be enough:
[code]|wiki|yui[/code]
Please consult the installation guide or customer support for your catch-all solution if you are unsure what lines are relevant, or if you don't use .htaccess files.
Once the rules are updated, in order for vBSEO to continue doing its original job with these changed rules, you also need to modify [i]vault/config.php[/i]. Find the line that defines VW_DEFAULT_SCRIPT, and change it to 'vbseo.php'