Jump to content

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*

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.