Jump to content











Photo
- - - - -

Attention: server transfer (2021)


  • Please log in to reply
72 replies to this topic

#51 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 16 March 2021 - 07:56 PM

If somebody over here has some regex skills and wants to write the expression, i'll take it :)

 

My regex fu is near zero atm, so i know it will take me lots of trial and error...

 

Regards,

Erwan



#52 Tokener

Tokener

    Frequent Member

  • Developer
  • 378 posts

Posted 17 March 2021 - 08:57 AM

If somebody over here has some regex skills and wants to write the expression, i'll take it :)

 

My regex fu is near zero atm, so i know it will take me lots of trial and error...

 

Regards,

Erwan

Hi Erwan

how are the "expressions" written? In a txt file or database?

 

I'd like to help.   T.



#53 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 17 March 2021 - 09:43 AM

Hi Erwan

how are the "expressions" written? In a txt file or database?

 

I'd like to help.   T.

 

from my understanding, here, it will be an apache configuration file.

some docs here.



#54 paraglider

paraglider

    Gold Member

  • .script developer
  • 1743 posts
  • Location:NC,USA
  •  
    United States

Posted 17 March 2021 - 12:02 PM

Think this is the search expression:

^.*/topic/([0-9]*).*#entry([0-9]*)$

This is the replace expression:

http://reboot.pro/index.php?showtopic=\1&view=findpost&p=\2

 


  • wimb likes this

#55 wimb

wimb

    Platinum Member

  • Developer
  • 3756 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 17 March 2021 - 01:40 PM

 

Think this is the search expression:

^.*/topic/([0-9]*).*#entry([0-9]*)$

This is the replace expression:

http://reboot.pro/index.php?showtopic=\1&view=findpost&p=\2

 

 

For the Downloads Links we need something else e.g. BootIce v1.3.3.3.2

http://reboot.pro/files/file/592-bootice-v1332/

must be replaced by 

http://reboot.pro/index.php?app=downloads&showfile=592

=

 

Does not occur so often, but Subforum Boot from USB / Boot anywhere

http://reboot.pro/forum/71/

must be replaced by

http://reboot.pro/index.php?showforum=71

=

 

More Info and here  and here

 

:cheers:



#56 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 17 March 2021 - 08:10 PM

 

Think this is the search expression:

^.*/topic/([0-9]*).*#entry([0-9]*)$

This is the replace expression:

http://reboot.pro/index.php?showtopic=\1&view=findpost&p=\2

 

 

 

if i use https://regexr.com/ to test with :

-test string : hxxp://reboot.pro/topic/21977-vhd-wimboot-apply-and-capture-of-wim-files-for-os-in-vhd/page-14#entry216443

-expression = ^.*/topic/([0-9]*).*#entry([0-9]*)$

-substitution = hxxp://reboot.pro/index.php?showtopic=$1&view=findpost&p=$2

 

i get as a result :  hxxp://reboot.pro/index.php?showtopic=21977&view=findpost&p=216443

 

which looks good !

 

so now i need to start testing apache and rewrite mod.


  • Brito and wimb like this

#57 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 18 March 2021 - 06:01 PM

ok, almost there...

 

first apache rewriterule works (so I know the rewrite mod is effective).

but not the second one.

 

any idea?

 

will continue testing.


        <Directory /var/www/reboot.pro>
        RewriteEngine On
#       RewriteRule ^toto\.html /titi.html [R=301,L]
        RewriteRule ^.*/topic/([0-9]*).*#entry([0-9]*)$ /index.php?showtopic=$1&view=findpost&p=$2 [R=301,L]
        </Directory>



#58 wimb

wimb

    Platinum Member

  • Developer
  • 3756 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 18 March 2021 - 06:07 PM

Not sure if it solves the issue but &view=findpost can (should) be omitted

 

Working Link is e.g.

http://reboot.pro/index.php?showtopic=21977&p=216443

You are using $1 and $2 whereas paraglider is using \1 and \2 as parameter  :unsure:



#59 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 18 March 2021 - 07:36 PM

Not sure if it solves the issue but &view=findpost can (should) be omitted

 

Working Link is e.g.

http://reboot.pro/index.php?showtopic=21977&p=216443

You are using $1 and $2 whereas paraglider is using \1 and \2 as parameter  :unsure:

 

If i use https://regexr.com/ or read the doc (here) it seems that I should be using $1 not /1.

 

For now it seems the match is not working : it should trigger a redirect to "something" but it does not.

 

From the apache doc (ignore the first two lines) :

 

In this example, a request for /test/1234 would be transformed into /admin.foo?page=test&id=1234&host=admin.example.com

rewrite_backreferences.png



#60 paraglider

paraglider

    Gold Member

  • .script developer
  • 1743 posts
  • Location:NC,USA
  •  
    United States

Posted 18 March 2021 - 11:48 PM

The think the start of the search is at /topic i.e it does not include the http:/reboot.pro so search string should be:

^/topic/([0-9]*).*#entry([0-9]*)$

 



#61 maro

maro

    Newbie

  • Members
  • 13 posts
  •  
    New Zealand

Posted 19 March 2021 - 07:25 AM

First up, until today I had no clue about Apache configurations, but as I thought to know enough about regular expressions, my interest was piqued. So, after reading a bit about RewriteRules I went on a search, and found an online tester.

As a result, I'd like to suggest to give it a try with the following rule:

RewriteRule ^topic/(\d+).*/page-(\d+)$ index.php?showtopic=$1&page=$2

I better make a few more comments:

  • Since the PCRE engine is employed, I've used '\d' instead of '[0-9]', but only because I'm a lazy typist.
  • I've used '+' (instead of '*') for the quantification, to ensure that this really amounts to a number.
  • I've omitted the flags (e.g. '[R=301,L]'), since I could not check their function in the online tester
  • The biggest surprise for me was, that the 'URI fragment' (i.e. '#entry216443' in the sample above) might not even be "seen" by the server. Initially I was gobsmacked, but I've read some more on Wikipedia, (quote: "... the agent sends the URI to the server, but does not send the fragment ..."). I even did a quick test with 'FiddlerCap', and it seems to be indeed the case.

Now, the last point means of course, that the intended rule (i.e. "converting" the "entry number" into a "post number") might not "fly". But I'd like to think that the combination of topicID, and pageID (plus the unchanged URI fragment, that the browser should add) might do the trick.

Furthermore, I'd imagine a few more rules are required to deal with the cases like:

hxxp://reboot.pro/topic/21977-vhd-wimboot-apply-and-capture-of-wim-files-for-os-in-vhd

and (my personal favorite):

hxxp://reboot.pro/topic/21977/

I'd imagine that the following rules could do the trick:

RewriteRule ^topic/(\d+).*$ index.php?showtopic=$1
RewriteRule ^topic/(\d+)/$ index.php?showtopic=$1

 
PS (1): May I suggest an additional "friendly name", which I don't recall, whether it ever existed in the past:

RewriteRule ^topic/(\d+)/(\d+)/$ index.php?showtopic=$1&page=$2

(I can't make up my mind, whether I like it better with, or without the trailing slash)

PS (2): My thanks to Erwan, who opened up this issue to an "free for all" (and provided enough background clues). One of my reasons to visit 'reboot.pro' is to find little inspirations to learn something new. So, thanks again for today's contribution to that "quest".


  • wimb and Tokener like this

#62 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 19 March 2021 - 08:40 PM

Guys,

 

Based on Maro's suggestion, i implemented the below which seems to work :

RewriteRule ^topic/(\d+).*$ index.php?showtopic=$1
RewriteRule ^topic/(\d+)/$ index.php?showtopic=$1

Try this link (or any other friendly url you may have) and let me know how it works for you : http://reboot.pro/topic/21977-vhd-wimboot-apply-and-capture-of-wim-files-for-os-in-vhd/page-14#entry216443 .

 

And thanks to paraglider and maro to put me/us on the right track :)

 

Regards,

Erwan


  • alacran likes this

#63 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 19 March 2021 - 11:06 PM

Thanks to erwan.l, paraglider and maro

 

I can confirm the implementation of the RewriteRules quoted in previous post are working very fine.

 

Tested with the link in previous post and from it opening the link to the new topic mentioned in that post, and also from that topic opening all links mentioned on it.

 

Now all friendly URL internal links are working fine again.

 

alacran



#64 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 20 March 2021 - 12:20 AM

Also I can confirm now the friendly URL link embedded into Wimlib-clc program made by our fellow retokener, also opens again the topic related to Wimlib-clc on reboot.pro

 

alacran



#65 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 20 March 2021 - 01:29 AM

Thanks to erwan.l, paraglider and maro

 

I can confirm the implementation of the RewriteRules quoted in previous post are working very fine.

 

Tested with the link in previous post and from it opening the link to the new topic mentioned in that post, and also from that topic opening all links mentioned on it.

 

Now all friendly URL internal links are working fine again.

 

alacran

 

But also the standard URL links are working fine.

 

So this means both are valid:

 

Sample:

Friendly URL: http://reboot.pro/topic/22383-reducing-win10-and-older-oss-footprint/

or standard URL: http://reboot.pro/index.php?showtopic=22383

Also testing a little further I confirmed new links to post are created using standard URL (wich IMHO is the best way, as it is the standard protocol used in all the web).

 

Sample editing first post on this topic: http://reboot.pro/in...showtopic=22383

 

 

  • Additional info about LibreOfficePortable on this Post
  • New info from wimb about LibreOfficePortable on Post No. 429

 

Where the first is an old created (2020-11-06) Friendly URL and the second (Bold) is a new created (2021-03-19) standard URL.

 

Wich are respectively links to:

http://reboot.pro/topic/22383-reducing-win10-and-older-oss-footprint/page-14#entry216974

and

http://reboot.pro/index.php?showtopic=22383&page=18#entry217901

alacran



#66 wimb

wimb

    Platinum Member

  • Developer
  • 3756 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 20 March 2021 - 07:25 AM

Thanks to erwan.lparaglider and maro  :) 

 

All friendly URL's to topic posts are working fine now,  :wub:

 

but Links for Downloads files still FAIL  :(

 

Try e.g. to download BootIce using http://reboot.pro/fi...-bootice-v1332/

 

Also Link to Subforum like Boot from USB / Boot anywhere is a problem e.g. try  http://reboot.pro/forum/71/

 

For the Downloads Links we need something else e.g. BootIce v1.3.3.3.2

http://reboot.pro/files/file/592-bootice-v1332/

must be replaced by 

http://reboot.pro/index.php?app=downloads&showfile=592

=

 

Does not occur so often, but Subforum Boot from USB / Boot anywhere

http://reboot.pro/forum/71/

must be replaced by

http://reboot.pro/index.php?showforum=71


#67 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 20 March 2021 - 11:46 AM

Tiny url's like http://reboot.pro/forum/71/ should now work.

 

I am not managing it for now for the files url's.

 

Also I dont get why the url does not get rewritten (in the url bar) for forum url's when it does for topics url's?

 

Current conf.

 <Directory /var/www/reboot.pro>
        RewriteEngine On
        RewriteRule ^topic/(\d+).*$ index.php?showtopic=$1
        RewriteRule ^topic/(\d+)/$ index.php?showtopic=$1
        RewriteRule ^forum/(\d+)/$ index.php?showforum=$1
        RewriteRule ^files/file/(\d+)/$ index.php?app=download&showfile=$1
 </Directory>



#68 wimb

wimb

    Platinum Member

  • Developer
  • 3756 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 20 March 2021 - 03:04 PM

 

Tiny url's like http://reboot.pro/forum/71/ should now work.

 

I am not managing it for now for the files url's.

 

Also I dont get why the url does not get rewritten (in the url bar) for forum url's when it does for topics url's?

 

Current conf.

 <Directory /var/www/reboot.pro>
        RewriteEngine On
        RewriteRule ^topic/(\d+).*$ index.php?showtopic=$1
        RewriteRule ^topic/(\d+)/$ index.php?showtopic=$1
        RewriteRule ^forum/(\d+)/$ index.php?showforum=$1
        RewriteRule ^files/file/(\d+)/$ index.php?app=download&showfile=$1
 </Directory>

 

forum link is working OK  :)

 

files RewriteRule should have downloads instead of download (the s is missing ....)



#69 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 20 March 2021 - 04:27 PM

forum link is working OK  :)

 

files RewriteRule should have downloads instead of download (the s is missing ....)

 

Good catch!

Still no luck thus : match is not working for now.

I'll try differents combinations.

 <Directory /var/www/reboot.pro>
        RewriteEngine On
        RewriteRule ^topic/(\d+).*$ index.php?showtopic=$1
        RewriteRule ^topic/(\d+)/$ index.php?showtopic=$1
        RewriteRule ^forum/(\d+)/$ index.php?showforum=$1
        RewriteRule ^files/file/(\d+)/$ index.php?app=downloads&showfile=$1
 </Directory>



#70 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 20 March 2021 - 04:34 PM

Everything should be OK now.

Tiny url's for topics, forums and downloads.

 

This online tester was a great help (thanks Maro).

 <Directory /var/www/reboot.pro>
        RewriteEngine On
        RewriteRule ^topic/(\d+).*$ index.php?showtopic=$1
        RewriteRule ^topic/(\d+)/$ index.php?showtopic=$1
        RewriteRule ^forum/(\d+)/$ index.php?showforum=$1
        RewriteRule ^files/file/(\d+).*/$ index.php?app=downloads&showfile=$1
 </Directory>


  • wimb and alacran like this

#71 wimb

wimb

    Platinum Member

  • Developer
  • 3756 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 20 March 2021 - 04:38 PM

 

Everything should be OK now.

Tiny url's for topics, forums and downloads.

 

This online tester was a great help (thanks Maro).

 <Directory /var/www/reboot.pro>
        RewriteEngine On
        RewriteRule ^topic/(\d+).*$ index.php?showtopic=$1
        RewriteRule ^topic/(\d+)/$ index.php?showtopic=$1
        RewriteRule ^forum/(\d+)/$ index.php?showforum=$1
        RewriteRule ^files/file/(\d+).*/$ index.php?app=downloads&showfile=$1
 </Directory>

 

Everything OK now.  :wub:

 

Thanks to erwan.lparaglider and maro   :) 



#72 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 20 March 2021 - 07:02 PM

*
POPULAR

For the record, please note that FURL is not enabled at the forum software level (aka "use_friendly_urls" parameter).

What we are doing here is using the apache rewriteurl feature to catch old friendly url's and to rewrite them on the fly.

This in order to support the old posts on this forum using FURL.


  • wimb, Tokener and alacran like this

#73 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 22 March 2021 - 05:28 PM

Wich are respectively links to:



http://reboot.pro/topic/22383-reducing-win10-and-older-oss-footprint/page-14#entry216974

and

http://reboot.pro/index.php?showtopic=22383&page=18#entry217901

alacran

Only FYI, the last one is "mixed mode", even if works the "canonical" link is (as currently generated by the board):

 

hxxp://reboot.pro/index.php?showtopic=22383&p=217901

 

As a side note, and just for the record the (good ol') syntax to get to posts by their offset in the thread was lost in one of the past updates of server or software.

I.e. your quoted post, which is #66 in the thread USED to be easily linkable, without knowing that it is post #217901 on the whole board by using the syntax:

hxxp://reboot.pro/index.php?showtopic=22430&st=65

i.e. &st=(post # - 1)

 

that currently (but since several years) resolves to the first post on a page :w00t: it USED to be (rounded) page # :frusty: divided by the number of set posts per page, i.e. 65/25= 2.6 -> 3 and this is not even fixed-fixed as sometimes in the past the board posts per page was changed from 20 to 25, and - for some time - one could use fractional page numbers (like 3.2) to get to a given post, but right now it is *random*, i.e.:

hxxp://reboot.pro/index.php?showtopic=22430&st=0 

is fine but 

hxxp://reboot.pro/index.php?showtopic=22430&st=1

goes to second page, as well as up to

hxxp://reboot.pro/index.php?showtopic=22430&st=25

BUT

hxxp://reboot.pro/index.php?showtopic=22430&st=26

goes to third page ...

 

... madness ...

 

:duff:

Wonko






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users