php+mod_rewrite

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
stakes
Forum Commoner
Posts: 48
Joined: Tue Jun 12, 2007 12:05 pm

php+mod_rewrite

Post 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.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post 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
Post Reply