I'm having difficulty wrapping my head around mod_rewrite for my home-rolled gallery script. I'm on a shared host, so all my web-viewable files are in the /home/my_user/public_html/ directory. I've got a sub-directory of that called browser. I want to put some .htaccess restrictions on that directory, so that a call to http://www.mydomain.ca/browser/Camping/Card1 will actually point to http://www.mydomain.ca/browser/index.ph ... ping/Card1.
RewriteEngine on
RewriteBase /browser/
RewriteRule ^/(.*)$ http://www.mydomain.ca/browser/test.php?path=$1 [R,L]
But that doesn't work - likely because I'm stabbing in the dark. I have a few questions still.
What exactly does RewriteBase do? From what I've read, that's the subdirectory where the RewriteRule starts its work. If I've got the .htaccess file sitting in /home/my_user/public_html/browser/, what should I have for the RewriteBase?
Is that regex going to work?
Thanks for any advice you guys have got.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
The two folders was only an example. After /browser/ there can be any number of directories, so the $1/$2 thing won't necessarily work. If I can just get everything after /browser/ to be included as a GET var, I can pull it apart in PHP.
Thanks though.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.