Page 1 of 1

php+mod_rewrite

Posted: Fri Oct 12, 2007 6:43 am
by stakes
Ok I've bee on this now for a while and it's driving me nuts!

All the files that are loaded with page=$ and sub=$ are located in /year12/ directory.

Code: Select all

RewriteRule ^year12/(.*)/(.*) year12.php?page=$1&sub=$2
This works:

year12/sample_page/

this also works

year12/sample_page/sub_page

HOWEVER.

i want users to be able to just go to

year12/

and land on year12.php

Right now all i get is a directory listing of the contents in year12 directory.

Could anyone point me in the right (re)direction? :lol:

thanks in advance.

Posted: Fri Oct 12, 2007 8:05 am
by Zoxive
Simplest way would probably be adding another line.

Code: Select all

RewriteRule ^year12(/?)       year12.php
RewriteRule ^year12/(.*)/(.*) year12.php?page=$1&sub=$2