Reputation: 1929
How can I take in an input to a domain (requested URL) and put it through my own php file (which will do the db query and then redirect users to proper location?
We basically have 1500+ pages that we are going to redirect. And URL structure is not exactly identical enough to be able to just do a simple .htaccess redirect.
If we can get it to read it in a .php file, I think I can make a script inside of that easily.
Upvotes: 0
Views: 175
Reputation: 74028
You must capture the URL path, redirect to your PHP script and add the path as a query string
RewriteEngine On
RewriteRule .* /script.php?$0 [QSA]
This will redirect all requests to script.php
with the URL path as the first $_GET
argument. The original query string, if any, will be appended ([QSA]
) to this as the second and following $_GET
arguments.
Upvotes: 1