Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
0 15 Mar 2020 16:11 u/argosciv in v/programmingComment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
Thanks again for the link to that htaccess guide. Still got a lot of learning there so I can reduce mess, but I think @cantaloupe6's comment might help with that (gotta learn what RewriteBase is for).
I was able to, on the php side, make site.com also redirect to site.com/home. I figure this is also possible via htaccess but now I'm hooked on .NET Core xD
Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
Update:
Worked out how to prettify urls via php :)
Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
Yeah, in a different programming language I worked in (not naming it) this is easy as pie, but in PHP, not so much.
O_O
php can suck a sick
.NET Core is fucking amazing when using Visual Studio.
Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
You really gonna buy PiG's spin here?
This subverse has no rule requirements for a link to be present in submissions.
Subverse rules:
- Be nice!
- This subvoat is about programming in general: Submissions must be directly programming related.
- Click-bait, blogspam, memes, job openings, ads and drama submissions will be removed.
- Everything must be accessible through the submission for everyone globally.
And wouldn't you know it, PiG and "Cransch" broke rule 1.
Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
I thought it was more for security, by hiding the structure of the application.
It's a bit of both really. Not so much worried about search engines, more user-friendliness, plus a bit of obfuscation (not that it would be too difficult to figure out what the underlying query is).
Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
I'm sure I've messed around with that in the past. Doing the reverse compat through php isn't going to be difficult, I'm just fucking around with .htaccess for now to get a feel for which rules work, don't work, and work best for me with the least amount of mess.
Reverse compat can wait :)
Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
Dude, you're a freakin' legend...
Now all I have to do is figure out reverse compatibility via .htaccess OR do some $_GET magic to turn a classic url into a pretty url and redirect using header("Location: ~").
Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
Here's an interesting article that explains exactly what you are looking for:
Fucking beautiful, exactly what I needed.
Yeah, in a different programming language I worked in (not naming it) this is easy as pie, but in PHP, not so much.
Yep, after I get the hang of this site deployment (as a template), I'm going to try to reproduce it in .NET and maybe others.
Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
Screenshots demonstrating reverse compatible url rewriting via IIS:
- index.php (with no action paramater) defaults to home page: https://files.catbox.moe/jqzwyo.png
- index.php?action=home will rewrite to /home: https://files.catbox.moe/c9sjx6.png
- /home and /admin/home will translate as index.php?action=home and index.php?action=admin&view=home respectively.
I'm hoping to achieve the same result on Apache (preferably with .htaccess, unless a better approach can be explained).
Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
One or both of us isn't understanding the other...
See the edited stipulations in the main post while I get back to you with some screenshots from my IIS deployment.
Comment on: Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
So you're suggesting:
- explode the url by "/"
- dump the first entry (domain) and second entry (index.php)
- populate $_GET based on the order of the rest of the results and their corresponding parameter name
?
Any goats got a moment to help me out with Apache (.htaccess) url rewriting?
1 0 comments 14 Mar 2020 04:29 u/argosciv (self.programming) in v/programmingComment on: I suck at regex... Can someone please explain why only example C is working here?
Was trying to split a user-inputted string into its characters and run ops on each character (if said character is a letter).
Turns out the regex was perfectly fine, I just had a logical error further down which at first appeared like a regex problem. Fixing the logical error showed that the regex was working perfectly fine.
The error being that I wasn't converting uppercase letters to lowercase letters when checking them against a dictionary which only has lowercase letters in it. This made me think that the regex was skipping over uppercase letters, but it wasn't, I just wasn't using them correctly (hence also why Example C 'worked' due to lowercasing the character at that particular point -- albeit that I didn't want to do so there).
Comment on: I suck at regex... Can someone please explain why only example C is working here?
Interesting approach there in your 4th example, hadn't considered that.
I'll see if I get acceptable results using your code in a minute. Thanks for taking the time.
Okay, what in the actual fuck is this black magick...
It's true, all of the examples in your code work.
Oh god fucking damnit, I just figured out where I was actually going wrong and it has nothing at all to do with the regex. Fuck my fucking life.
Comment on: I suck at regex... Can someone please explain why only example C is working here?
Okay, what in the actual fuck is this black magick...
It's true, all of the examples in your code work.
Comment on: I suck at regex... Can someone please explain why only example C is working here?
Interesting approach there in your 4th example, hadn't considered that.
I'll see if I get acceptable results using your code in a minute. Thanks for taking the time.
Comment on: I suck at regex... Can someone please explain why only example C is working here?
I've tried a few (?i)/(?-i) variations, except the second one from your comment. Just tried that in a few variations, no dice.
Comment on: I suck at regex... Can someone please explain why only example C is working here?
They are indeed only 1 character strings. Original string was converted to a CharArray, to then be iterated through.
Comment on: I suck at regex... Can someone please explain why only example C is working here?
Tried (?-i) in example A. Is /i proper syntax?
According to documentation, the best approach is to use a kestrel "reverse proxy" deployment (request <-> IIS / Apache / Nginx <-> Kestrel <-> .NET).