Jump to content

Getting Rewrite to work properly


SharkBait

Recommended Posts

When you don't do something for a long time.. it slips from you! Or at least it does for me.

 

RewriteRule ^([A-za-z]+)$ index.php?dir=$1 [L]

 

What I want to accomplish is:

 

blah.com/pix/Tree

or

blah.com/pix/Tugboat

 

the index.php file within /pix will use the Tugboat or Tree as variables (via GET). Though.. the tricky part is that Tree an Tugboat will actually be directories with photos in them.

 

The idea was to have /pix handle URL requests to display the photos within the specified directories. I don't want people to access the directories.

 

Can it be done? Can we trick Apache into thinking there are no directories, when there are?

 

Just creating a really quick and easy photo thing for myself. All i have to do is drop the photos into a directory and then blah.com/pix/racecar will allow me to display the photos within that directory via the index.php file that will style the single page.

 

 

Link to comment
https://forums.phpfreaks.com/topic/211909-getting-rewrite-to-work-properly/
Share on other sites

use a separate .htaccess in the real directories

 

/.htaccess

/pix/.htaccess

 

Anyway i dont think its possible to block access to the actual images by using a redirect without the image not showing up, this only works with included files

What I decided to do was rename the directories to have a character similar to them blahblah-p and then when someone goes to

 

blah.com/pix/blahblah  it will pull the files from blahblah-p directory if it exists. *shrug*

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.