[svlug] .htaccess rewrite rule

Marco Walther marco at sonic.net
Thu Mar 6 10:05:40 PST 2008


On Thursday 06 March 2008 07:25:48 Skip Evans wrote:
> Hey all,
>
> I need to create an .htaccess rewrite rule to
> convert the following.
>
> The user accesses the site with
>
> http://prepcube.com/wi/madison/
>
> I need a rewrite rule that will convert this to
>
> http://precube.com/index.php?state=wi&school=madison
>
> I know this should rewrite anything to index.php,
> and this is what I have so far:
>
> <IfModule mod_rewrite.c>
>          Options +FollowSymlinks
>          RewriteEngine On
>          RewriteRule ^(.*) index.php [L]
> </IfModule>

Did you try something like

<IfModule mod_rewrite.c>
          Options +FollowSymlinks
          RewriteEngine On
          RewriteRule 
^/([^/]+)/([^/]+)/(.*)$ /index.php?state=%1&school=%2&reminder=%3 [L,QSA]
</IfModule>

Thanks,
-- Marco


>
> But I'm not sure how to get the $_GET vars into
> the RewriteRule.
>
> Any help would be greatly appreciated. I'm reading
> up on rewrite rules now, but finding them a bit
> overwhelming at this first attempt.





More information about the svlug mailing list