Forum

URL rewrite rule osCommerce

carlo
20 March 2015, 13:54
I found hiawata 3 days ago and tried it right away for its taking philosophy. Have anyone a working UrlToolkit for osCommerce? I found one for nginx as an example http://wiki.nginx.org/OsCommerce. Thanks alot in advance


Hiawatha version: 9.12
Operating System: debian sid
Hugo Leisink
21 March 2015, 12:14
It will be something like this. Note that I haven't tested it. If this one works, please let me know. I'll add it to the HOWTO page for URL rewriting.

UrlToolkit {
ToolkitID = oscommerce

Match ^/includes/.*\.php$ DenyAccess
Match ^/admin/includes/.*\.php$ DenyAccess
Match ^/admin/backups DenyAccess
Match ^/download DenyAccess

# osCommerce rewrites
Match ^/([a-z0-9/-]+)-p-([0-9]+).html(\?.*)? Rewrite /product_info.php$3
Match ^/([a-z0-9/-]+)-c-([0-9_]+).html(\?.*)? Rewrite /index.php$3
Match ^/([a-z0-9/-]+)-m-([0-9]+).html(\?.*)? Rewrite /index.php$3
Match ^/([a-z0-9/-]+)-pi-([0-9]+).html(\?.*)? Rewrite /popup_image.php$3
Match ^/([a-z0-9/-]+)-pr-([0-9]+).html(\?.*)? Rewrite /product_reviews.php$3
Match ^/([a-z0-9/-]+)-pri-([0-9]+).html(\?.*)? Rewrite /product_reviews_info.php$3

# Articles contribution
Match ^/([a-z0-9/-]+)-t-([0-9_]+).html(\?.*)? Rewrite /articles.php$3
Match ^/([a-z0-9/-]+)-au-([0-9]+).html(\?.*)? Rewrite /articles.php$3
Match ^/([a-z0-9/-]+)-a-([0-9]+).html(\?.*)? Rewrite /article_info.php$3

# Information pages
Match ^/([a-z0-9/-]+)-i-([0-9]+).html(\?.*)? Rewrite /information.php$3

# Links contribution
Match ^/([a-z0-9/-]+)-links-([0-9_]+).html(\?.*)? Rewrite /links.php$3

# Newsdesk contribution
Match ^/([a-z0-9/-]+)-n-([0-9]+).html(\?.*)? Rewrite /newsdesk_info.php$3
Match ^/([a-z0-9/-]+)-nc-([0-9]+).html(\?.*)? Rewrite /newsdesk_index.php$3
Match ^/([a-z0-9/-]+)-nri-([0-9]+).html(\?.*)? Rewrite /newsdesk_reviews_info.php$3
Match ^/([a-z0-9/-]+)-nra-([0-9]+).html(\?.*)? Rewrite /newsdesk_reviews_article.php$3
}
carlos
21 March 2015, 12:50
Thank you for your time.
Im running into trouble when restarting

Starting webserver: Syntax error in hiawatha.conf on line 115.
error!

Match -p-(?<id>[0-9]+)\.html$ Rewrite /product_info.php?products_id=$id
Hugo Leisink
21 March 2015, 18:38
Based on what I've found for Apache [wordpress.org], I've adjusted the UrlToolkit rule above.
carlo
21 March 2015, 19:32
Its not working, the images are not shown and links are giving at static php (shipping etc): No input file specified. With dynamic urls it gave me 404.
I have it on my local desktop with virtual domains in hosts file. The images and links are sourced with localhost instead of the domain specified in hosts file.
Hugo Leisink
21 March 2015, 21:26
Well, I'm not familiar with osCommerce. You have the Hiawatha version of the rewrite rules for osCommerce. So, from here on you have to do some testing and tweaking yourself.
This topic has been closed.