RE: [PHP] Using mod_rewrite with PHP
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I've been wrestling with mod_rewrite and trying to understand how to use it for my particular purpose. I've got two php URLs I'd like to rewrite to make them search-engine friendly. Currently they look like: Example 1: http://mysite.com/foobar.html?c=23 Example 2: http://mysite.com/foobar.html?c=23p=45 What I'd like to end up with is something like: Example 1: http://mysite.com/foobar/23 Example 2: http://mysite.com/foobar/23/45 I'm kind of new to mod_rewrite and regexp's, so can anybody give me a clue? This is how I do it. Use this rewrite RewriteRule ^/foobar/(.*) /foobar?rest_of_url=/$1 Then everything after foobar/ will be put into $PATH_INFO. I then call these lines at the top of every page $PATH = explode(/,$PATH_INFO); array_shift($PATH); now $PATH[0] = 23 $PATH[1] = 45 etc... Get it HTH M@ -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBO1fz66W0/zC+QxWwEQLhpQCfS4a43fa3uxCcx2q/i3KukAw5KJsAn1uJ 5c5sd5weQLr7AoXasYCkqJZO =sGVV -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Using mod_rewrite with PHP
Hi Miri! On Thu, 19 Jul 2001, Miri wrote: I'm using this no problem on a server running apache, but we have one client who insists on IIS and I have not been able to get it to work. Has anyone been able to get this to work with IIS? If so, any words of wisdom? :) I am using it w/ success straight in PHP w/o mod_rewrite. Just have a look at PATH_INFO. -- teodor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Using mod_rewrite with PHP
try this url, maybe it will help... http://www.zend.com/tips/tips.php?id=68single=1 --- Gawain [EMAIL PROTECTED] wrote: I've been wrestling with mod_rewrite and trying to understand how to use it for my particular purpose. I've got two php URLs I'd like to rewrite to make them search-engine friendly. Currently they look like: Example 1: http://mysite.com/foobar.html?c=23 Example 2: http://mysite.com/foobar.html?c=23p=45 What I'd like to end up with is something like: Example 1: http://mysite.com/foobar/23 Example 2: http://mysite.com/foobar/23/45 I'm kind of new to mod_rewrite and regexp's, so can anybody give me a clue? Thanks! Gawain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Using mod_rewrite with PHP
I'm using this no problem on a server running apache, but we have one client who insists on IIS and I have not been able to get it to work. Has anyone been able to get this to work with IIS? If so, any words of wisdom? :) At 09:25 PM 7/19/01 -0700, rm wrote: try this url, maybe it will help... http://www.zend.com/tips/tips.php?id=68single=1 --- Gawain [EMAIL PROTECTED] wrote: I've been wrestling with mod_rewrite and trying to understand how to use it for my particular purpose. I've got two php URLs I'd like to rewrite to make them search-engine friendly. Currently they look like: Example 1: http://mysite.com/foobar.html?c=23 Example 2: http://mysite.com/foobar.html?c=23p=45 What I'd like to end up with is something like: Example 1: http://mysite.com/foobar/23 Example 2: http://mysite.com/foobar/23/45 I'm kind of new to mod_rewrite and regexp's, so can anybody give me a clue? Thanks! Gawain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] ___ [EMAIL PROTECTED] [EMAIL PROTECTED] http://miriland.com/ http://www.stigma.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]