 |

Glasairmell
User
Feb 16, 2008, 1:52 AM
Post #1 of 4
(381 views)
Shortcut
|
Hi Dave, Would you please post and example of how you did a mod rewrite so a viewer file that shows as: yourwebsite.com/viewer.php/1/page.php becomes: yourwebsite.com/viewer/1/page.php of course I would choose another name other then "viewer" ... just using that to keep things clear. Also, can one eliminate the "num" call from the url so it ends up as: Yourwebsite.com/viewer/page.php I would really like to replace the "1,2,3 etc" with a directory name so the url ends up like: yourwebsite.com/viewer/whatido/page.php I know how to work with your viewerfunction.php file, I am just not clear how dependent the program is on the "num" call for the url. Thanks!
|
|
|  |
 |

Glasairmell
User
Feb 17, 2008, 11:53 AM
Post #2 of 4
(321 views)
Shortcut
|
This is what I ended up using for my specific application. ##################### REWRITE RULES ##################### Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteRule ^/?([^/]*)/([0-9]*)/?([^/]*)$ $1.php?$2 [L]
|
|
|  |
 |

Dave
Staff
/ Moderator

Feb 18, 2008, 10:38 AM
Post #3 of 4
(302 views)
Shortcut
|
Thanks for posting that. I haven't actually done a lot with mod_rewrite (other than copying and pasting other code) so I'll use that as a base when exploring it more. You can drop the number and lookup records by something else. It just requires a bit of custom PHP and MySQL. Basically you just create a field in the editor called 'filename' (or whatever you like), make it unique, and query that in the where clause option like this: $options['where'] = 'filename = "/whatido/page.php"'; You just need a little PHP code to pull that part out of the url, escape it, and then put it in the where clause. Try this in your page viewer code.
$escapedFilename = escapeMysqlString( @$_SERVER['PATH_INFO'] ); $options['where'] = "filename = '$escapedFilename'"; Test it out by adding: print $options['where']; after to make sure it's printing the right thing. Hope that helps! Let me know how it goes. Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 | |  |
|