| 7:05 pm on Dec 4, 2002 (gmt 0)|
you could also do the same effect as mod rewrite with your php. The url could be parsed and then used as vars for your queries.
php reads the url, cuts out $cat = cat1 and $sub = sub1 and then goes and finds all the info about it. I do this for menus and content a lot. The script figures out where it is in the directory structure and loads all pertinent info based on the url.
Similar to mod_rewrite and similar to get strings but all done with pure php and mysql.
| 7:14 pm on Dec 4, 2002 (gmt 0)|
I'm sorry jatar_k but I'm not following you.
If I have a link with "www.mydomain.com/somefile.xml" how would I know to use the php template file to parse the XML file using PHP? Something has to call the parser.
| 7:28 pm on Dec 4, 2002 (gmt 0)|
when I can't or don't want to use mod_rewrite I often have to fake it. I create the directory structure, in the file I include the template/script. It then reads the url it was called from and does whatever it needs to do based on the url.
I don't know, maybe mod_rewrite is easier depending on the number of pages/links you need to have.
Just the way I have done things a lot of times, it seems to make perfect sense when it's in my head but I don't seem capable of explaining today. Think I will have to get more coffee.
I guess my answers to your questions were something like this
3. differently - yes
more efficiently - don't know, probably equal
| 8:08 pm on Dec 4, 2002 (gmt 0)|
Back on the mod_rewrite:
Would this be the right direction to head in?
RewriteRule ^foo\.html$ foo.php?f=foo.xml [T=application/x-httpd-cgi]
| 11:19 pm on Dec 4, 2002 (gmt 0)|
You donīt need to add the MIME type when the server is configured to let PHP handle .php files.
BTW if you want to use mod_php then the MIME type would need to be application/x-httpd-php not application/x-httpd-cgi.
If all your pages are produced by the same script then a rewrite rule like this will be more generic.
|RewriteRule ^(.*)\.html$ foo.php?f=$1.xml |
| 1:10 pm on Dec 5, 2002 (gmt 0)|
I should have cleaned that up a bit before I posted it but I just wanted to know if it would be problematic with the SEs.
| 1:22 pm on Dec 5, 2002 (gmt 0)|
There wonīt be any problems if the SEs see ordinary links like foo.html.
BTW do you serve XML directly to the client or do you transform it on the server and then serve HTML as you do for the SEs?
| 4:23 pm on Dec 5, 2002 (gmt 0)|
The current game plan is to parse the XML using PHP's Expat Library and XSLT. That's why I needed to use mod_rewrite in .htaccess so that when a .html or .xml file of a certain type is requested, the script is initiated and serves up the correct HTML version.