General
Getting Support
Administration
Design
Wolf Reference
Plugin Development
Core Development
- Design documents
- Working guidelines
- References
Press, Graphics and Translations
Wolf CMS books section
Removing the question mark from the url
The default installation of Wolf CMS generates a question mark in the URLs it generates. This is for compatibility purposes, so Wolf CMS will run on almost any HTTP server by default.
However, most people (and search engines) don't really like this question mark. You can disable/remove the question mark after you installed Wolf CMS.
By default, Wolf CMS supports Apache. Other HTTP servers are supported based on user input.
Updated to reflect Wolf CMS 0.6.0
You must carry out both the “General actions” and the additional instructions for your specific webserver (Apache, Lighttpd, etc.).
General actions
The following actions should always be executed in order for Wolf CMS to use clean urls.
- Temporarily add write permissions to the config.php file.1)
- Edit the config.php file
- Change the value of “USE_MOD_REWRITE” to “true”.
- Save the config.php file.
- Remove the write permissions from the config.php file. Don't forget or skip this step!2)
- Apply the directions for your specific HTTP server. See below.
- After applying the directions, test out the change by going to the root of your website. You should no longer see the question mark.
Apache HTTP server actions
- Edit the _.htaccess file located in the Wolf CMS root directory.
- Save the _.htaccess file.
- Rename the _.htaccess file into .htaccess (i.e. remove the underscore).
Lighttpd server actions
The paths used in the rewrite code below assume that your Wolf CMS installation lives at the root of the site, i.e. http://www.example.com.
Since Lighttpd does not have an equivalent of Apache's RewriteBase command, you will have to manually alter the paths below to conform to your Wolf CMS root.
#
# Wolf CMS mod_rewrite rules for lighttpd
#
# If your Wolf CMS install lives in a sub-directory like: http://www.example.com/mywolf/
# you should add the subdirectory between ^ and / in the rules below and in the
replacement
# value, for example: "^/mywolf/admin(.*)$" => "/mywolf/admin/index.php?$1",
#
url.rewrite-once = (
"^/install/index.html$" => "/install/index.php?rewrite=1",
"^/install/index.php$" => "/install/index.php?rewrite=1",
"^/install/$" => "/install/index.php?rewrite=1",
"^/install/(.*)$" => "/install/$1",
"^/admin/(images|javascripts|stylesheets|themes)/(.*)" => "/admin/$1/$2",
"^/admin/index.php\?(.*)$" => "/admin/index.php?$1",
"^/admin(.*)$" => "/admin/index.php?$1",
"^/favicon\.ico$" => "$0",
"^/(public|wolf)/(.*)$" => "/$1/$2",
"^(?:(?!/admin/))/([^?]*)(\?(.*))$" => "/index.php?WOLFPAGE=$1&$2",
"^/(.*)$" => "/index.php?WOLFPAGE=$1"
)
If you are using Wolf CMS 0.7.x, the location of some of the pages has changed. You will need to use the following instead. Since this uses url.rewrite-if-not-file, you will need at least version 1.4.24 of lighttpd.
url.rewrite-once = (
"^/wolf/install/index.html$" => "/wolf/install/index.php?rewrite=1",
"^/wolf/install/index.php$" => "/wolf/install/index.php?rewrite=1",
"^/wolf/install/$" => "/wolf/install/index.php?rewrite=1",
"^/wolf/install/(.*)$" => "/wolf/install/$1",
)
url.rewrite-if-not-file = (
"^/([^\?]+)(\?(.*)$)?" => "/index.php?WOLFPAGE=$1&$3"
)
Hiawatha server actions
The paths used in the rewrite code below assume that your Wolf CMS installation lives in a “site” directory below the root of the system, i.e. http://www.example.com/site.
Since Hiawatha does not have an equivalent of Apache's RewriteBase command, you will have to manually alter the paths below to conform to your Wolf CMS root.
You will need an UrlToolkit similar to this where 'site' is the folder in the web root where Wolf CMS is unpacked.
UrlToolkit {
ToolkitID = wolfcms
Match ^/site/install/index.html$ Rewrite /site/install/index.php?rewrite=1
Match ^/site/install/index.php$ Rewrite /site/install/index.php?rewrite=1
Match ^/site/install/$ Rewrite /site/install/index.php?rewrite=1
RequestURI exists Return
Match ^/site/admin(.*)$ Rewrite /site/admin/index.php?$1
Match ^/site(.*)$ Rewrite /site/index.php?WOLFPAGE=$1
}
Remember to enable this toolkit in your Virtual Host.
The 3 regex above RequestURI are used for clean url validation during installation only. They must be above RequestURI and can be commented out after installation.
You must have PreventSQLi disabled (is also the default I think).
Nginx server actions
The paths used in the rewrite code below assume that your Wolf CMS installation lives at the root of the site, i.e. http://www.example.com.
Since Nginx does not have an equivalent of Apache's RewriteBase command, you will have to manually alter the paths below to conform to your Wolf CMS root.
Put this in your server block:
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?WOLFPAGE=$1 last;
break;
}
You may also have to set the URL suffix to be blank
define('URL_SUFFIX', '');
in config.php
Zeus server actions
map path into SCRATCH:path from %{URL}
look for file at %{SCRATCH:path}
if exists then goto END
look for dir at %{SCRATCH:path}
if exists then goto END
match URL into $ with ^/(.*)$
if matched
look for file at $1
if not exists
set URL=/index.php?WOLFPAGE=$1
goto END
endif
endif
