Forum Moderators: phranque

Message Too Old, No Replies

Basic .htacces

RewriteRule for folder hierarchy

         

DustinGreen

7:31 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



Hi!

I have four links.

www.url.com/f1/
www.url.com/f1/f2/
www.url.com/f1/f2/f3/
www.url.com/f1/f2/f3/f4/

BUT I want to make folders f2, f3 and f4 virtual with .htaccess.

currently I send all traffic from these pages to a single file: /f1/index.php

That file includes another file depending on the link.

The problem is that all my traffic is going to the single /f1/index.php file.

I want to split my traffic up buy sending all traffic going to /f1/ to a file and all traffic going to /f1/f2/ to a different file, etc. etc.

can anyone solve/understand my question?

nickCR

10:52 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



Your post is a little confusing however I think what you need is some simple rewriting. This forum is really not designed to tell you how to write your code rather explain how it works and go from there.

How the rewrite rules works is this:

Between the ^ and the $ you insert what you are looking to match so if you have ^f1/$ that rule will match "f1". Then you have file.php which is what will load if the first part matches.

So in the example below when you reach f1/ it will load file.php:

RewriteRule ^f1/$ file.php [L]
RewriteRule ^f1/f2/$ file2.php [L]
RewriteRule ^f1/f2/f3/$ file3.php [L]

phranque

1:15 am on Jul 13, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, dg!

always best to post examplified and simplified code with a description of requirements, expectations, attempts and results.

from your description, you are probably looking for an internal rewrite which "hides the file" from the browser.