We offer a seamless solution to make your ontology URIs resolvable and content negotiable by allowing URL redirection for your ontology URIs to our Agroportal URIs. To facilitate this process, we've provided you with a set of .htaccess rewrite rules. By following the simple instructions below, you'll be able to implement these rules swiftly and efficiently, ensuring smooth redirection

Instructions for Apache servers
  1. Access .htaccess File: Locate the .htaccess file in the root directory of your website, if it doesn't exist create one. This file controls how your web server behaves and is often used for URL rewriting and redirection.
  2. Copy and Paste Redirect Rules in the .htaccess file: Copy the rewrite rules provided in the black rectangle. Open the .htaccess file and paste the copied redirect rules into the file
  3. Enable rewrite module (Linux): you'll need to ensure that the Apache module called 'rewrite' is enabled by running the command `sudo a2enmod rewrite`
RewriteEngine On RewriteRule ^PO2/?$ https://agroportal.lirmm.fr/ontologies/PO2 [R=301,L] RewriteCond %{REQUEST_URI} ^.*PO2/.*$ RewriteRule ^.*/([^/#]+)/?$ https://agroportal.lirmm.fr/ontologies/PO2/$1 [R=301,L]
RewriteEngine On
RewriteRule ^PO2/?$ https://agroportal.lirmm.fr/ontologies/PO2 [R=301,L]
RewriteCond %{REQUEST_URI} ^.*PO2/.*$
RewriteRule ^.*/([^/#]+)/?$ https://agroportal.lirmm.fr/ontologies/PO2/$1 [R=301,L]

Instructions for Nginx servers
  1. Access Nginx configuration file: The location of this file can vary depending on your system, but common locations include /etc/nginx/nginx.conf, /etc/nginx/sites-available/default or /usr/local/etc/nginx/nginx.conf.
  2. Locate the server block or location block where you want to enable URL rewriting: This is typically within the server { ... } block.
  3. Copy and Paste Redirect Rules : Copy the rewrite rules provided in the black rectangle. Inside the appropriate block, add the copied rules to enable URL rewriting
  4. Test the configuration for syntax errors: Run the following command to test the redirection configuration `sudo nginx -t`
  5. Reload Nginx to apply the changes: Restart the nginx server to apply the redirection using this command `sudo systemctl reload nginx`
location / { rewrite ^/PO2/?$ https://agroportal.lirmm.fr/ontologies/PO2 permanent; if ($request_uri ~* PO2/ ){ rewrite ^.*/([^/]+)/?$ https://agroportal.lirmm.fr/ontologies/PO2/$1 permanent; } }
location / {
    rewrite ^/PO2/?$ https://agroportal.lirmm.fr/ontologies/PO2 permanent;
    if ($request_uri ~* PO2/ ){
        rewrite ^.*/([^/]+)/?$ https://agroportal.lirmm.fr/ontologies/PO2/$1 permanent;
    }
}
Note
This redirection works only for uri with the form of: url/path/resource_id This will not work for uris in the form of: url/path/to/something#resource_id OR url/path/to/something:resource_id