iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Webmaster Resources Discussion Forum Sitemaps and robots and logfiles -- Oh My! If you have any questions, comments, concerns and/or ideas about the tools currently available to webmasters to make their lives... 'easier'. Here's where you need to be. Know of a good tool? Post it here. Got something funny in your logfiles? Maybe we can help.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-03-2009, 06:46 PM
Moderator
WebProWorld Moderator
 
Join Date: Oct 2003
Location: Alberta, Canada
Posts: 881
weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6
Question redirect from folder only to index in parent folder

I'm trying to remove all the index pages from a set of image folders and use an index.php page in the parent folder to retrieve contents using a query string. It's not friendly, but I don't really care.

What I want is to take this,

/pictures/cars/

and make it into

/pictures/index.php?fd=cars

Everything is working for me, but I need to create the redirect before I remove the index pages that are in each sub-folder. It will also be necessary, one supposes, to redirect from the actual url, as well:

/pictures/cars/index.php

also redirected to

/pictures/index.php?fd=cars

I'm working toward using a single include to drive several dozen picture folders, themselves contained in section folders, using a discovery script to retrieve otherwise unknown contents. Right now I have it down to a single index in each pictures folder.

There is an index.php and an index1.php, the former acting as a slideshow, and the latter a still image viewer (clicking the picture in the slide show opens the still). Also, from the main section page there are links out to individual photos using their ID in the query string.
Reply With Quote
  #2 (permalink)  
Old 10-04-2009, 12:40 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,661
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: redirect from folder only to index in parent folder

The following two rules should work:

RedirectMatch 301 ^/pictures/(.*)/$ /pictures/index.php?fd=$1
RedirectMatch 301 ^/pictures/(.*)/index.php$ /pictures/index.php?fd=$1
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #3 (permalink)  
Old 10-05-2009, 02:29 AM
Moderator
WebProWorld Moderator
 
Join Date: Oct 2003
Location: Alberta, Canada
Posts: 881
weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6
Default Re: redirect from folder only to index in parent folder

Thanks, wige. Just one problem:

How does one prevent Apache from rewriting '?' to '%3f' ? This is throwing an error that reports a url missing when in fact if you paste the url reported, the page opens.
Reply With Quote
  #4 (permalink)  
Old 10-05-2009, 11:36 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,661
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: redirect from folder only to index in parent folder

Oh, Apache and it's query strings... you would probably need to use mod_rewrite then

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/pictures/.*/$ [OR]
RewriteCond %{REQUEST_URI} ^/pictures/.*/index.php$
RewriteRule ^/pictures/([a-z]*)/ /pictures/index.php?fd=$1
__________________
The best way to learn anything, is to question everything.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Webmaster Resources Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
redirect folder to single replacement image weegillis IT Discussion Forum 9 04-29-2009 04:15 PM
Primary Domain redirect to folder pingram3541 Web Programming Discussion Forum 4 04-15-2009 01:38 PM
301 Redirect for entire folder? spenland Search Engine Optimization Forum 0 11-02-2005 08:15 PM
How to link to sub folder index pages Ellio Search Engine Optimization Forum 2 10-19-2005 02:08 PM
How do I make a new folder using FTP? labrynth_of_fire Web Programming Discussion Forum 4 11-17-2003 06:17 PM


All times are GMT -4. The time now is 01:28 AM.



Search Engine Optimization by vBSEO 3.3.0