Open pcav opened 11 years ago
+1 !
@mdouchin already done in 3.2.0 ?
@laurentj can you review it ? How to activate shorter urls in lizmap ?
@reluc the urls.xml.dist contains some URLs declaration, but this was a work in progress. I have a (very old) branch that contains more fix in order to be able to activate significant url, but i did not finished.
So there are still some work to do. It is definitively for a futur version, not for 3.2, except if you want to delay the release of 3.2
ok move to 3.3
Hi,
recently, I had to shorten a Lizmap URL on my installation. It took me a while to figure out how to do that. So, after I got it work I wrote the little documentation below. Maybe it is useful (e.g. for inclusion in the installation/administration guide).
If you would be interested in a PR, let me know where in the documentation you would want such a section (a pointer to gihub repo and file would be nice)...
Lizmap URLs can be long and cumbersome to use and communicate. Therefore rewriting and simplification of the URLs can be helpful. During Lizmap installation, mod_rewrite should have been enabled already, so the prerequisites should be in place.
This is how to go about to shorten Lizmap URLs:
1.) Add the following entry in the VirtualHost section of:
/etc/apache2/sites-available/000-default.conf
:
<VirtualHost>
(...)
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
2.) Create a .htaccess file (or edit it if it already exists) with the following entries at /var/www/html
:
# Start rewrite engine
RewriteEngine on
# Define rewrite rule(s)
RewriteRule ^MYPROJECT$ lizmap/index.php/view/map/?repository=1&project=MYPROJECT [QSA]
Here, multiple rewrite rules can be specified for multiple Lizmap repositories. A rewrite rule consists of four components, separated by white space:
1) RewriteRule
: The instruction to be processed by apache2
2) ^MYPROJECT$
: the source, the requested URL on the host that is supposed to be mapped to a php query of a given Lizmap repository.
Here ^ marks the beginning and $ marks the end in the URL a user has to call to open a map from a specific Lizmap repository.
So, on host www.example.com
, requesting the URL www.example.com/MYPROJECT
would open Lizmap repository 1 with project MYPROJECT for a lizmap web client installed to /var/www/html/lizmap
.
3) lizmap/index.php/view/map/?repository=1&project=MYPROJECT
: the target, the query that is is to be executed when a users calls the simplified URL (e.g. www.example.com/MYPROJECT
).
The query is appended to the base URL of the level where the .htaccess file is stored. Note that you may have installed lizmap to a different subdirectory.
4) [QSA]
: Flags, indicating how the Rewrite rule is supposed to be processed.
For more detailed infromation on URL rewriting, see Apache2 documentation
I agree, this should go into the docs. In fact, a sample .htaccess
should probably be installed with Lizmap, leaving the user only the need to edit the VH.
Hello everyone. I'm following the @ninsbl solution but I'm facing some issue: in "lizmap/index.php/view/map/?repository=1&project=MYPROJECT" my "lizmap" folder is a virtual link instead of a folder inside html. Should I take some correction in procedure?
Current URL are very long and confusing, e.g.:
One could add links, apache VHost, and/or http://docs.jelix.org/en/manual-1.4/urls/significant