.htaccess with public folder

Posted by ninumedia on Stack Overflow See other posts from Stack Overflow or by ninumedia
Published on 2010-06-03T03:36:04Z Indexed on 2010/06/03 3:44 UTC
Read the original article Hit count: 312

Filed under:
|

I have a directory structure with the following on localhost:

http://localhost/testing/

A directory structure exists inside of testing as follows:

/testing/public
/testing/public/index.php
/testing/public/img
/testing/public/css
..etc for the js and swf directories

A .htaccess file is inside the testing folder and the contents are as follows:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /testing/

RewriteRule ^public$ public/ [R,QSA]
RewriteRule ^public/$ public/index.php?state=public [L,QSA]

RewriteRule ^stackoverflow$ stackoverflow/ [R,QSA]
RewriteRule ^stackoverflow/$ public/index.php?state=stackoverflow[L,QSA]

I am using PHP and inside of the /testing/public/index.php file I wanted to test that the $_GET['state'] is indeed saving the variable.

When I try to test out:

http://localhost/testing/public

$_GET['state'] is not found at all BUT

http://localhost/testing/stackoverflow

does indeed echo out that $_GET['state'] equals 'stackoverflow'.

What am I missing here??? Why is it that I cannot get the state=public in the first link? Thanks for the help!

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about mod-rewrite