Forum

URL rewrite rule osCommerce with search engine safe urls

carlo
25 October 2015, 12:07
Hello

i got another question to that: /forum/topic/1904

Im using standard osCommerce search engine safe urls, one explanation here:
https://xenforo.com/community/threads/apache-nginx-rewrite-assistance-request.32953/

As i understand the RegeEx rewrites this must nevertheless be catched?
product_info.php/products_id/26 (with search engine safe urls)
product_info.php?products_id=26 (without)

The $3 in the rewrite should do this, or not? Thanks for your time.
Hugo Leisink
25 October 2015, 12:19
I guess you are referring to "Match ^/([a-z0-9/-]+)-p-([0-9]+).html(\?.*)? Rewrite /product_info.php$3".

Every $x refers to the content of the x-th parenthesis. So, $3 is the part within the last parenthesis in the expression above. The expression above rewrites an URL like /blah-p-1234.html?foo=bar to /product_info.php?foo=bar. The $3 makes sure the ?foo=bar part is included in the new URL. The URL's you provided do not match with the expression ([a-z0-9/-]+)-p-([0-9]+).html.
carlo
25 October 2015, 12:51
Ok, thanks. So i have to learn RegEx magic. '?' and '=' must be replaced with '/' in $3, right?
Hugo Leisink
25 October 2015, 12:54
Uh, I don't understand what you mean. With regular expressions, nothing 'must be'. It's just a way to select strings that match a certain pattern and, optionally, to change the string.
carlo
25 October 2015, 13:18
So it has to catch /blah-p-1234.html/products_id/26 and then is $3 in good shape?
Hugo Leisink
25 October 2015, 13:20
What do you mean with 'good shape'? My advice: learn about regular expressions and everything will be clear.
carlo
25 October 2015, 13:39
With good 'good shape' I mean the right rewrite. I'll take your advice, thank you.
carlo
26 October 2015, 14:18
I had a look on RegEx and found out that i dont need it. I dont need seo html and so i just wont for instance this: product_info.php/products_id/26
If i call any php without appendix it works, but if i call anything like *.php/* for instance product_info.php/products_id/26 or index.php/cPath/22 there comes the 404.
Its always the same even with an empty UrlToolkit
Hugo Leisink
26 October 2015, 14:20
To make *.php/* work, set "EnablePathInfo = yes" for your virtual host.
carlo
27 October 2015, 14:47
Thank you! Its now running as expected, sorry for confusing.
Hugo Leisink
27 October 2015, 15:35
No problem. Good to hear it works.
This topic has been closed.