I am going to have about 200 pages which I would like to have in the form
http://www.domain.com/Page Name/
which would be mod_rewritten into
http://www.domain.com/landingPage.php?k=Page Name
I only want to redirect the pages that are present in a mysql database. Is it possible to mod_rewrite based on a list outputt by a php file [the php file would read all entries in a table and echo them].
Php created list in .htaccess
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Since .htaccess is read before any content is served you won't be able to do it in realtime. The only thing I can think of is to have CRON run every 30 mins or whatever and modify your .htaccess file based upon the database contents...
It's not perfect though.
EDIT | Depending upon how your database is managed you may even be able to have a PHP script update the .htaccess file in synchronisation with updates to the database
It's not perfect though.
EDIT | Depending upon how your database is managed you may even be able to have a PHP script update the .htaccess file in synchronisation with updates to the database
What the, I though I answered this one...
Well well, eitherway, why can't you just mod_rewrite to a static php-file? (the sent address can be found in $_SERVER)
That way the script can do some nice db-query, view the page, do a redirect (if you want it that way), or thrown an error if it is desired.
Works really well.
Well well, eitherway, why can't you just mod_rewrite to a static php-file? (the sent address can be found in $_SERVER)
That way the script can do some nice db-query, view the page, do a redirect (if you want it that way), or thrown an error if it is desired.
Works really well.