Forum

Nibbleblog

Pierre
27 June 2014, 16:59
Does anyone have an idea on the rewrite rules for Nibbleblob (www.nibbleblog.com)?
Wasn't able to find anything about it here and on the internet. So maybe someone knows how to convert rewrite rules from Nginx to Hiawatha?!

I found these for Nginx:
    # rewrite rules if file/folder did not exist
location @rewrites {
rewrite ^/dashboard$ /admin.php?controller=user&action=login last;
rewrite ^/feed /feed.php last;
rewrite ^/category/([^/]+)/page-([0-9]+)$ /index.php?controller=blog&action=view&category=$1&page=$2 last;
rewrite ^/category/([^/]+)/$ /index.php?controller=blog&action=view&category=$1&page=0 last;
rewrite ^/page-([0-9]+)$ /index.php?controller=blog&action=view&page=$1 last;
}

# location catch for /post-#/Post_Title
# will also catch odd instances of /post-#/something.php
location ~ ^/post-([0-9]+)/ {
rewrite ^ /index.php?controller=post&action=view&id_post=$1 last;
}

# cache control for static files
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}


# common files to deny/tweak
location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
location ~ /\. { access_log off; log_not_found off; deny all; }
location ~ ~$ { access_log off; log_not_found off; deny all; }


Hiawatha version: 9.6
Operating System: openSUSE 13.1 64-Bit (PHP 5.4)
Hugo Leisink
28 June 2014, 13:23
It must be something like this. Be careful, I haven't tested it.
UrlToolkit {
Match \.(?:ico|css|js|gif|jpe?g|png)$ Expire 2 months Return
Match ^/dashboard$ Rewrite /admin.php?controller=user&action=login
Match ^/feed Rewrite /feed.php
Match ^/category/([^/]+)/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&category=$1&page=$2
Match ^/category/([^/]+)/$ Rewrite /index.php?controller=blog&action=view&category=$1&page=0
Match ^/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&page=$1
Match ^/post-([0-9]+)/ Rewrite /index.php?controller=post&action=view&id_post=$1
}
Pierre
30 June 2014, 15:19
I changed it to
UrlToolkit {
ToolkitID = nibbleblog
Match ^/admin$ Rewrite /admin.php?controller=user&action=login
Match ^/category/([^/]+)/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&category=$1&number=$2
Match ^/category/([^/]+)/$ Rewrite /index.php?controller=blog&action=view&category=$1&number=0
Match ^/tag/([^/]+)/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&tag=$1&number=$2
Match ^/tag/([^/]+)/$ Rewrite /index.php?controller=blog&action=view&tag=$1&number=0
Match ^/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&number=$1
Match ^/post/([^/]+)/$ Rewrite /index.php?controller=post&action=view&post=$1
Match ^/post-([0-9]+)/(.*)$ Rewrite /index.php?controller=post&action=view&id_post=$1
Match ^/page/([^/]+)/$ Rewrite /index.php?controller=page&action=view&page=$1
Match ^/feed/$ Rewrite /feed.php
Match ^/([^/]+)/$ Rewrite /index.php?controller=page&action=$1
}

This works great and might be added to the HOWTOs?

Thanks a lot for the fast response. I know understand the scheme and mechanism a lot better. And thanks for such a great, fast, secure, functional and beautiful webserver.
This topic has been closed.