[svlug] Help with rewrite rules?

Skip Evans skip at bigskypenguin.com
Sat Jun 28 15:26:55 PDT 2008


Hey all,

I need help getting a rewrite rule working that 
will translate a URL into another with args that 
can be read in PHP with $_GET.

I think in addition to the rule itself, I have a 
config issue that is stopping me from testing it.

Basically, I need a rule that would translate

http://www.varsitybeat.com/wi/madison

into

http://www.varsitybeat.com?st=wi&sc=madison

Likewise it should do the same if the www is not 
included.

I've been reading up on these things, and trying 
to morph a sample of one I found into something 
like this:


Options +FollowSymlinks
RewriteEngine ON
RewriteCond %{REQUEST_URI} ^/../.*$ [NC]
RewriteRule ^files/([^/]+)/([^/]+) 
/index.php?st=$1&sc=$2 [NC]

However, when I try the following test URL

http://prepcube.venomouspenguin.com/wi/madison/

I am getting a 404 error,
The requested URL /wi/madison/ was not found on 
this server.

My VH entry for this subdomain looks like this:

<VirtualHost *:80>
         DocumentRoot /usr/home/prepcube/public_html
         ServerName prepcube.venomouspenguin.com
         <Directory "/usr/home/prepcube/public_html/">
             Options Indexes FollowSymLinks
             DirectoryIndex index.php index.html 
index.html.var
             Order Allow,Deny
             Allow from all
             AllowOverride all
         </Directory>
</VirtualHost>

I also have this in httpd.conf

LoadModule rewrite_module 
libexec/apache2/mod_rewrite.so

Can anyone see what I've got wrong here? Any help 
would be much appreciated!!!

Thanks!
Skip
-- 
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison, WI 53703
608-250-2720
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and versatile
PHP/MySQL, AJAX & DHTML development framework.
http://phpenguin.bigskypenguin.com/




More information about the svlug mailing list