Re: Re: Using mod_rewrite and PHP

From: Date: Thu, 27 Feb 2003 08:58:34 +0000
Subject: Re: Re: Using mod_rewrite and PHP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-137367@lists.php.net to get a copy of this message
You can do this in your PHP code by itself, no need to use Apache. Search for "search engine safe" or "search engine friendly". Fusebox.org has some default code that does this (follow the links for PHP fusebox). HTH, Peter Janett New Media One Web Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PostgreSQL coming soon! http://www.newmediaone.net webmaster@newmediaone.net (303)828-9882 ----- Original Message ----- From: "Dan Phiffer" <dan@phiffer.com> To: <php-general@lists.php.net> Sent: Thursday, February 27, 2003 1:29 AM Subject: [PHP] Re: Using mod_rewrite and PHP > At the advice of a friendly php-general reader, I tried the following: > > RewriteEngine on > Options +FollowSymlinks > RewriteBase /issues/ > RewriteCond %{REQUEST_FILENAME} -d > RewriteRule ^(.+)([/]?)$ $1/ [R] > > RewriteRule ^([0-9]/[a-z]/[a-z0-9])([/]?) > /index.php?year=$1\&month=$2\&article=$3 > > And here's my /issues/index.php: > > <?php > > print_r($_GET); > > ?> > > Requesting http://localhost/issues/2003/feb/issue/ gives a 404 > file not > found (the logfile shows that it's looking for an un-rewritten URI). > Requesting http://localhost/issues/ displays "Array ( > )" as expected. > Strangely, going to http://localhost/issues redirects me to the > hostname > (which I have set to 'asdf', causing my browser to end up at > http://www.asdf.com). > > I guess I should have said this earlier, but I'm testing on Win32/PHP > 4.3.1/Apache 1.3.27, and have verified the problem on a FreeBSD platform as > well. > > Anyway, thanks for any more pointers, > -Dan > > > "Dan Phiffer" <dan@phiffer.com> wrote in message > news:20030227073324.44389.qmail@pb1.pair.com... > > So I'm trying to implement a URL system like so: > > > > http://domain.org/issues/2003/feb/article-name/ > > > > such that http://domain.org/issues/index.php will display > > the requested > > page. I've read a little about this > > (http://www.alistapart.com/stories/succeed/) and have gotten it to work > for > > the most part, but there's one problem I'd like to resolve. > > > > Here's how I've got it set up: > > > > - I put a .htaccess file in http://domain.org/issues like > > so: > > > > RewriteEngine on > > RewriteRule !\.(gif|jpg|png|css|js)$ index.php > > > > - /issues/index.php contains code to respond to REQUEST_URI and serve > > content > > appropriately. > > > > - Requests to /issues/ should serve an index sort of page, which works > fine. > > > > However, if a request is made to /issues (no trailing slash), the browser > is > > sent an Error 400 Bad Request. > > > > I tried the following after looking at the URL Rewriting Guide > > (http://httpd.apache.org/docs/misc/rewriteguide.html): > > > > RewriteEngine on > > RewriteBase /issues/ > > RewriteCond %{REQUEST_FILENAME} -d > > RewriteRule ^(.+[^/])$ $1/ [R] > > > > Unfortunately, with this in place the browser displays a 302 Found message > > with a link to the same problematic URL (/issues). I'm still pretty new to > > mod_rewrite, so please bear with me if I'm doing something obviously wrong > > here. > > > > Thanks, > > -Dan > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#137367) next »