How to process a directory in the URL as a parameter
P粉154798196
P粉154798196 2024-01-10 18:01:39
0
1
421

I'm sure I need to use some overridden conditionals to handle this, but I don't quite understand it yet.

Take a sample URL as an example:

https://example.com/guest-area/{TENANT-NAME}/login

Here, {TENANT-NAME} should be treated as a GET parameter by PHP, so actually the URL should be treated as:

https://example.com/guest-area/login/?tenant={TENANT-NAME}

However, it should appear in the address bar like the first example and be accessible to the user.

The value of

{TENANT_ID} will always come after /guest-area, so anything given between the next set of forward slashes should be treated as $_GET['tenant']Instead of a directory. Any directory after it (e.g. /login) is a "real" directory.

P粉154798196
P粉154798196

reply all(1)
P粉060112396

Put this content into your .htaccess file

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^guest-area/(.*)/login /guest-area/login/?tenant=
RewriteRule ^guest-area/(.*)/login/ /guest-area/login/?tenant=
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template