I have functionality on a cloud page that depends on the cloud page url. I know how to Requestparameter(), but how do I get the entire url using ampscript or SSJS?
You can get the current page url in amp script by using
RequestParameter('PageURL'). This gives you the url dynamically without you having to hardcode.
Reference: Look at How to Fetch a html form's Post variables using AMPSCRIPT and create a record with the values in salesforce objects specifially @Eliot's answer He is using the below snippet to submit the form to the current page.
<form action="%%=RequestParameter('PAGEURL')=%%" method="post">
You can try debugging your currentURL in the page using inline variables like below.