• TO DOWNLOAD YOU NEED TO BUY AN UPGRADE

Setting up user friendly URLs

HAWK

Administrator
Staff member
ADMIN
MODERATOR
XENFORO 2 SVIP
XENFORO 2 VIP
XF1 SVIP
XF 1 VIP
VERIFIED
REGISTERED
#1
OAYTOG0_1200.jpg
With WoltLab Suite, it is possible to convert URLs into a more readable form.

WoltLab Suite offers an URL rewrite feature to turn default URLs like http://example.com/index.php?board-list/ into more compact and user friendly URLs, e.g. http://example.com/board-list/. Enabling this feature requires a special configuration applied to your webserver.

Note: If you changed the paths during the installation of WoltLab Suite, you have to adapt them in the rewrite rules!

Apache / LiteSpeed

Create a file called .htaccess and add the following code to it:

Code: .htaccess
  1. <IfModule mod_rewrite.c>
  2. RewriteEngine on
  3. RewriteBase /
  4. # Rewrite application /blog/
  5. RewriteCond %{SCRIPT_FILENAME} !-d
  6. RewriteCond %{SCRIPT_FILENAME} !-f
  7. RewriteRule ^blog/(.*)$ blog/index.php?$1 [L,QSA]
  8. # Rewrite application /calendar/
  9. RewriteCond %{SCRIPT_FILENAME} !-d
  10. RewriteCond %{SCRIPT_FILENAME} !-f
  11. RewriteRule ^calendar/(.*)$ calendar/index.php?$1 [L,QSA]
  12. # Rewrite application /gallery/
  13. RewriteCond %{SCRIPT_FILENAME} !-d
  14. RewriteCond %{SCRIPT_FILENAME} !-f
  15. RewriteRule ^gallery/(.*)$ gallery/index.php?$1 [L,QSA]
  16. # Rewrite application /filebase/
  17. RewriteCond %{SCRIPT_FILENAME} !-d
  18. RewriteCond %{SCRIPT_FILENAME} !-f
  19. RewriteRule ^filebase/(.*)$ filebase/index.php?$1 [L,QSA]
  20. # Rewrite application /forum/
  21. RewriteCond %{SCRIPT_FILENAME} !-d
  22. RewriteCond %{SCRIPT_FILENAME} !-f
  23. RewriteRule ^forum/(.*)$ forum/index.php?$1 [L,QSA]
  24. # Rewrite application /cms/
  25. RewriteCond %{SCRIPT_FILENAME} !-d
  26. RewriteCond %{SCRIPT_FILENAME} !-f
  27. RewriteRule ^cms/(.*)$ cms/index.php?$1 [L,QSA]
  28. # Rewrite application /
  29. RewriteCond %{SCRIPT_FILENAME} !-d
  30. RewriteCond %{SCRIPT_FILENAME} !-f
  31. RewriteRule ^(.*)$ index.php?$1 [L,QSA]
  32. </IfModule>
Display More
Upload the file to the main directory of your installation.

nginx

Edit the site/vhost configuration and insert the following code. Please adjust the path /forum (line 1 and 4) to match the installation Directory.

Code
  1. location / {
  2. index index.php;

  3. try_files $uri $uri/ @rewrite;
  4. }
  5. location @rewrite {
  6. rewrite ^/(forum/|cms/|calendar/|filebase/|blog/|gallery/)?([a-zA-Z0-9-/]+)$ /$1index.php?$2 last;
  7. }
IIS 7.5 or higher

Create a file called web.config and the following code to it:

XML: web.config
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <system.webServer>
  4. <rewrite>
  5. <rules>
  6. <rule name="WoltLab Suite Blog">
  7. <match url="^blog/(.*)$" />
  8. <action type="Rewrite" url="blog/index.php?{R:1}" />
  9. <conditions>
  10. <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  11. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  12. </conditions>
  13. </rule>
  14. <rule name="WoltLab Suite Calendar">
  15. <match url="^calendar/(.*)$" />
  16. <action type="Rewrite" url="calendar/index.php?{R:1}" />
  17. <conditions>
  18. <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  19. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  20. </conditions>
  21. </rule>
  22. <rule name="WoltLab Suite Gallery">
  23. <match url="^gallery/(.*)$" />
  24. <action type="Rewrite" url="gallery/index.php?{R:1}" />
  25. <conditions>
  26. <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  27. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  28. </conditions>
  29. </rule>
  30. <rule name="WoltLab Suite Filebase">
  31. <match url="^filebase/(.*)$" />
  32. <action type="Rewrite" url="filebase/index.php?{R:1}" />
  33. <conditions>
  34. <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  35. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  36. </conditions>
  37. </rule>
  38. <rule name="WoltLab Suite Forum">
  39. <match url="^forum/(.*)$" />
  40. <action type="Rewrite" url="forum/index.php?{R:1}" />
  41. <conditions>
  42. <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  43. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  44. </conditions>
  45. </rule>
  46. <rule name="WoltLab Suite Core">
  47. <match url="^cms/(.*)$" />
  48. <action type="Rewrite" url="cms/index.php?{R:1}" />
  49. <conditions>
  50. <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  51. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  52. </conditions>
  53. </rule>
  54. <rule name="User Friendly URLs">
  55. <match url="^(.*)" />
  56. <action type="Rewrite" url="index.php?{R:1}" />
  57. <conditions>
  58. <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  59. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  60. </conditions>
  61. </rule>
  62. </rules>
  63. </rewrite>
  64. </system.webServer>
  65. </configuration>
Upload the file to the main directory of your app installation.
 
Top