Can Abyss be configured to ignore certain rewrite rules?

 
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting
View previous topic :: View next topic  
Author Message
JMMotyer
-


Joined: 06 Jul 2005
Posts: 43
Location: Burlington (Toronto), Ontario, Canada

PostPosted: Mon May 30, 2022 12:40 pm    Post subject: Can Abyss be configured to ignore certain rewrite rules? Reply with quote

Hello, folks,

A few months ago, user Horizon introduced me to URL Rewriting, when s/he guided me how to direct all my non-www traffic to www, and it works perfectly... thank you again, Horizon.

Next, I wanted to run a script on a number of my sites (hosts), but that script was written for Apache, and required the use of htaccess files. As Abyss does not use htaccess, a couple of months ago the gurus (i.e. experts) at Aprelium translated the htaccess rules into a format that Abyss recognizes, and those rules & those scripts have worked flawlessly... thank you again, Aprelium.

Now, my question at this time is, not HOW to do it, but IF it is possible that Abyss can make some exceptions to the htaccess-equivalent rules.

My rewrite rule # 1, from non-www to www, is fine.

My 4 rewrite rules # 2-5 are for the script that uses htaccess, which for lack of a better description, in my layman's terms, directs everything to index.

But I have 3 aliases setup in Abyss that need to somehow ignore those 4 rewrite rules # 2-5.

Is it possible that I can setup Abyss to process that 1st rewrite rule (non-www to www) first, and THEN to allow Abyss to process those 3 aliases (and possibly more in the future) normally, and ONLY THEN process the 4 htaccess-equivalent rewrite rules?

If this is not possible, it's absolutely no big deal. The reason why I ask is, normally, on my sites that DON'T use those rewrite rules # 2-5, I can access those aliases with domain/aliasname, but because those rewrite rules # 2-5 for my other domains rewrite /index.php?/$1/ (or index.php?/$1/), so for those sites domain/aliasname does not work, I instead have to specifically enter in domain/aliasname/filename (i.e. domain/aliasname/index.php).

For example, for one of sites that does NOT use rewrite rules # 2-5, I can enter in:
https://www.fusionwings.com/webstats
https://www.fusionwings.com/guestbook

But for one my sites that DOES use rewrite rules # 2-5, I cannot enter in:
https://www.gallerywings.me/webstats
https://www.gallerywings.me/guestbook

Instead, I have to include the filename at the end, such as:
https://www.gallerywings.me/webstats/index.php
https://www.gallerywings.me/guestbook/gbook.php

I have no idea IF Abyss can handle that, which is my inquiry at this time. I have not listed any of my current rules here yet, as if it's not possible to accomplish this, no use filling up space in this post with a bunch of code :-).

Thanks in advance & have yourselves a great day.

Regards & be safe,

John
Back to top View user's profile Send private message Visit poster's website
Horizon
-


Joined: 18 Feb 2022
Posts: 25

PostPosted: Mon May 30, 2022 3:49 pm    Post subject: Reply with quote

Hi,
What you want to do is actually possible by tricking Abyss into doing it.

The question then becomes:
Are you requesting a proper solution or is tricking Abyss into doing it or a workaround acceptable as well?.

If you don't mind using a workaround, which basically tricks Abyss Web Server into doing what you want, then I can say that what you want is possible.

1. Put your web applications into their own dedicated folders.

2. Create URLRewrite rules that are 'Relative to base' for your specific web applications.

(The rules then become isolated from other app rules thanks to the Relative to base feature.)

3. Then at the top of the URLRewrite list, keep the www-redirection rule, but add right after it internal redirects to your web application folders depending on the alias requested by the visitor.

You then have Rewrite rules that only apply to specific web applications and will not interfere with other web apps.

If needed, you can also check the Host HTTP header to apply a Rewrite rule only for a specific hostname.
Back to top View user's profile Send private message
JMMotyer
-


Joined: 06 Jul 2005
Posts: 43
Location: Burlington (Toronto), Ontario, Canada

PostPosted: Mon May 30, 2022 10:32 pm    Post subject: Reply with quote

That sounds like exactly what I would like to accomplish. Like I have done since the days of DOS with computer programs, all my website scripts are in their individual separate folders; they're all even outside of the Abyss Web Server folder hierarchy.

I can manage to grasp the overall concept of your steps 2 & 3, but I have absolutely no idea how to setup the rewrite rules.

The examples I mentioned above, are the exact details for 1 of the 4 hosts that I would like to accomplish this for:

https://www.gallerywings.me/webstats/index.php
https://www.gallerywings.me/guestbook/gbook.php

Here is a snippet of that current host, with just the relevant (host, alias & rewrites) sections. Rather than paste the 279 lines of code in this post, I thought it was better to include it separately, which you can see at this link:

https://www.serendipity.cloud/rewrites.txt

As you're a rewrite guru, where & how do I begin?

Thanks in advance, it is greatly appreciated.

Regards,
John
Back to top View user's profile Send private message Visit poster's website
admin
Site Admin


Joined: 03 Mar 2002
Posts: 1246

PostPosted: Thu Jun 02, 2022 10:43 pm    Post subject: Reply with quote

JMMotyer,

Why not inserting a rule between #1 and #2 which will match with virtual path regex ^/webstats[/]+$ and redirect internally to /webstats/index.php and stop matching ?
_________________
Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com
Back to top View user's profile Send private message
JMMotyer
-


Joined: 06 Jul 2005
Posts: 43
Location: Burlington (Toronto), Ontario, Canada

PostPosted: Fri Jun 03, 2022 12:30 am    Post subject: Reply with quote

Perfect... almost. Thanks for getting back to me with your suggestion.

I created a new rule, and placed it near the top after my non-www to www rule, but it still needs to be tweaked slightly, as rewriting rules are still new to me & way above my level of knowledge & understanding.

Here is what I have so far, but I am no doubt still missing something, most likely the Conditions setting(s):



I also have no idea where that "regex" goes that you mention.
Back to top View user's profile Send private message Visit poster's website
admin
Site Admin


Joined: 03 Mar 2002
Posts: 1246

PostPosted: Sun Jun 05, 2022 8:59 pm    Post subject: Reply with quote

JMMotyer,

The rule's type should be global.

The virtual path regex (regular expression) should be ^/webstats[/]*$

Does it work as expected?
_________________
Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com
Back to top View user's profile Send private message
JMMotyer
-


Joined: 06 Jul 2005
Posts: 43
Location: Burlington (Toronto), Ontario, Canada

PostPosted: Mon Jun 06, 2022 1:06 pm    Post subject: Reply with quote

Nope, it only worked partially, quite possibly because of the latter 5 rewrite rules.

No need to spend any more time on this issue, as I can quite easily just enter in the entire URL for the few times it's accessed :-).

Thanks everyone for the suggestions to date on this topic.

Have yourselves a great day & be safe.

Regards,
John
Back to top View user's profile Send private message Visit poster's website
pkSML
-


Joined: 29 May 2006
Posts: 941
Location: Michigan, USA

PostPosted: Tue Jun 07, 2022 8:23 pm    Post subject: Reply with quote

Hello JMMotyer.

I see one problem you're having in the image you shared.

When you use a slash in the type "Relative to base," you don't include the slash in the beginning of your regex. (BTW, "regex" = REGular EXpression)

So just take the slash out of your virtual path regular expression, and the rewrite should work.

Regular expressions are very powerful in programming, but there's definitely a learning curve to them!

Edit: I didn't see the last two posts before posting... Aprelium's solution does the same thing.

Are you just wanting to redirect https://www.gallerywings.me/webstats --> https://www.gallerywings.me/webstats/index.php and avoid typing in the /index.php part?

If so, and your rewrite is set to global instead of relative to base, your regular expression would be
Code:
^/webstats$

Then just perform a 301 or 302 (external) redirection to
Code:
/webstats/index.php

_________________
Stephen
Need a LitlURL?


http://CodeBin.yi.org
Back to top View user's profile Send private message Visit poster's website
JMMotyer
-


Joined: 06 Jul 2005
Posts: 43
Location: Burlington (Toronto), Ontario, Canada

PostPosted: Wed Jun 08, 2022 9:54 am    Post subject: Reply with quote

Perfect, I have it working now.



It didn't work with internal redirection, but works perfectly with external redirection :-)

Much appreciated, Stephen, for your expertise & suggestion.

Have yourself a great day.

Regards,
John
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group