Timeline for htaccess redirect based on referrer URL string
Current License: CC BY-SA 4.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S May 21, 2020 at 9:38 | history | suggested | Glorfindel | CC BY-SA 4.0 |
broken link fixed
|
May 21, 2020 at 9:32 | review | Suggested edits | |||
S May 21, 2020 at 9:38 | |||||
Oct 23, 2019 at 11:55 | comment | added | MrWhite |
So, your URLs are just extensionless? /foo maps to /foo.php ? Presumably you have other directives in your .htaccess file that handle this? (Or are you using MultiViews?)
|
|
Oct 23, 2019 at 11:53 | answer | added | MrWhite | timeline score: 1 | |
Oct 23, 2019 at 11:32 | comment | added | Huskie69 |
In that case, it would be /product-configurator.php . If this can be handled in PHP, how would I redirect/rewrite the referrer by testing the HTTP-REFERER url?
|
|
Oct 23, 2019 at 11:15 | comment | added | MrWhite |
"the if exists on both /product-configurator and /bikes-configurator " - so why do you need to redirect/rewrite the request? Shouldn't the Referer just be checked in PHP and act accordingly?
|
|
Oct 23, 2019 at 11:10 | comment | added | MrWhite |
But that's not a PHP file. When you request /product-configurator , Apache needs to route the request to a physical script in order to handle the request. (eg. Many CMS's have a front-controller that sends all requests to index.php .)
|
|
Oct 23, 2019 at 11:07 | comment | added | Huskie69 |
It's /product-configurator (but the if exists on both /product-configurator and /bikes-configurator )
|
|
Oct 23, 2019 at 11:05 | comment | added | MrWhite | So which PHP file is handling the request? | |
Oct 23, 2019 at 11:04 | comment | added | Huskie69 |
There's a PHP test - something like if (isset($_POST["bike"])) { do stuff ...}
|
|
Oct 23, 2019 at 11:01 | comment | added | MrWhite |
How is /bikes-configurator then routed in your app? (This presumably does not map directly to a physical file?)
|
|
Oct 23, 2019 at 9:10 | comment | added | Huskie69 |
If there's a way rewrite internally then that's even better, but I need to retain the POST data (I thought a 307 redirect was the only way of doing this). The 3rd party does nothing except POST to my site - they don't issue any GETS. The rule would just need to work for any traffic coming from the referrer with that string bikes=1 in the HTTP_REFERER string
|
|
Oct 23, 2019 at 8:58 | comment | added | MrWhite | Any specific reason why you want to externally "redirect" the request rather than internally "rewrite" the request - as the destination appears to be on the same server? (Does the 3rd party follow redirects? Or is this simply a request via a browser?) Are you only wanting to "redirect" POST requests? (Your example rule with also redirect GET.) | |
Oct 23, 2019 at 8:20 | review | First posts | |||
Oct 23, 2019 at 8:30 | |||||
Oct 23, 2019 at 8:19 | history | asked | Huskie69 | CC BY-SA 4.0 |