RE: [PHP] mod_rewrite q's: syntax?

From: Date: Mon, 10 Apr 2006 20:19:37 +0000
Subject: RE: [PHP] mod_rewrite q's: syntax?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-233695@lists.php.net to get a copy of this message
On Mon, April 10, 2006 12:50 am, Micky Hulse wrote: >> -----Original Message----- >> From: Chris [mailto:dmagick@gmail.com] >> Do you need to do it with a mod_rewrite? >> >> if not, you can do it easily in php: >> >> header('location: folder/file.php'); >> exit(); >> >> in index.php. > > > Unfortunately, yes... I am using a CMS, and my current setup is > forcing me > into using the more complicated mod_rewrite. > > Well, not that it is a bad thing... seems like mod_rewrite is more > search-engine/bot friendly. > > Thanks for the tip though, I really appreciate your time. Another alternative, if mod_rewrite confuses you as much as it does me... .htaccess <Files folder> ForceType application/x-httpd-php </Files> DocumentIndex folder folder <?php $pathinfo = $_SERVER['PATH_INFO']; //I always forget if it's PATHINFO or... //do whatever you want with the $pathinfo to include the right code or return the right content or... ?> On the plus side, this doesn't force people into example.com when they went to www.example.com -- It just works. :-) PS I you do stick with mod_rewrite, turn mod_rewrite_debug *ON* and tail -f your http error_log for awhile. You'll learn a lot about what will/won't work for mod_rewrite in your rules... The warnings about mod_rewrite debugging/logging performance issues are a bit over-stated, I think... Or, at least, you need to do this on a development server with "real" traffic patterns for your testing, if doing it live is a non-option. Doing it on only the URLs *you* think of typing doesn't count. Those pesky real users can come up with some really interesting URLs to type... :-) -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#233695) next »