My Routes:
Get().route('/amp/@website', 'PageController@amp_info').name('amp_info'),
Get().route('/@website', 'PageController@info').name('info')
This works: https://websiteopedia.com/www.eventsnow.com this does not https://websiteopedia.com/https://www.eventsnow.com/
What do I need to do differently? the slash in params redirected to the 404 as it didn't find any matching route
Yes, in order to achieve this you have two options: using inputs or creating a route compiler
You can make the url simply go to the info
method with nothing special in the url:
Get().route('/', 'PageController@info').name('info')
Then you can hit routes like https://websiteopedia.com/?website=https://www.eventsnow.com/
Then inside the info
method, you would get the input as normal:
def info(self, request: Request):
request.input('website') #== 'https://www.eventsnow.com/'
A route compiler is simply a way to compile regex in the URL. You can make a new compiler in one of the boot methods in your service providers.
This new compiler would look like this:
def boot(self, view: View):
view.compile('url', r'([^\s]+)')
Then you can construct the route like this:
Get().route('/@website:url', 'PageController@info').name('info')
This will now compile that into the regex you provided and you can now hit the routes like you were previously.