GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Htaccess code to redirect folders root with no index ? (https://gfy.com/showthread.php?t=647449)

Doctor Dre 08-23-2006 02:28 AM

Htaccess code to redirect folders root with no index ?
 
Right now It just appears as an empty folder... i wanna redirect it to the main page... tried to google it but can't find it.

Webby 08-23-2006 02:44 AM

Not sure if this is what you want....


Redirect /emptydirectory/ http://yoursite.com/whatever.htm

Mmmm.. not sure about the slash after emptydirectory - may have to drop that

Doctor Dre 08-23-2006 02:45 AM

It's not the empty directories I want to refresh, but the ones that are full but have no index page. I want it done automacly (not folder by folder). I have thousands of them on the site...

I accidently re-wrote htaccess

DamageX 08-23-2006 02:47 AM

Put this in your .htaccess:
Code:

DirectoryIndex main.html, index.html, index,shtml, index.php
This redefines the order in which it looks for your index pages. If you leave it only to main.html (assuming that's the name of your main page, if not rename as fit), then it will look for it in all further subdirectories. Thus the need to add more pages to the list.

Webby 08-23-2006 02:48 AM

Again.. not sure :winkwink:

DirectoryIndex whatever.htm

ie.. where there is no default index and you want to address a main page as the default index?

Webby 08-23-2006 02:49 AM

Quote:

Originally Posted by DamageX
Put this in your .htaccess:
Code:

DirectoryIndex main.html, index.html, index,shtml, index.php
This redefines the order in which it looks for your index pages. If you leave it only to main.html (assuming that's the name of your main page, if not rename as fit), then it will look for it in all further subdirectories. Thus the need to add more pages to the list.

Gittin there! :winkwink:

Doctor Dre 08-23-2006 02:51 AM

Quote:

Originally Posted by DamageX
Put this in your .htaccess:
Code:

DirectoryIndex main.html, index.html, index,shtml, index.php
This redefines the order in which it looks for your index pages. If you leave it only to main.html (assuming that's the name of your main page, if not rename as fit), then it will look for it in all further subdirectories. Thus the need to add more pages to the list.

Thanks for your time but what I want to do is :

when there is no index file, it just redirects to the site URL.
Basicly i got hundreads of folders containing galleries but do not use any index page. users try too type new folders to see if there are more galleries... so i want to use the 404 traffic to feed a tgp.

Doctor Dre 08-23-2006 02:52 AM

Quote:

Originally Posted by Webby
Again.. not sure :winkwink:

DirectoryIndex whatever.htm

ie.. where there is no default index and you want to address a main page as the default index?

DirectoryIndex http://www.mydomain.com
That would redirect the index to my domain when there is no index.htm file ?

Webby 08-23-2006 02:55 AM

Got ya!

We talking 404's to cover this?

ErrorDocument 404 /yourpage.htm

DamageX 08-23-2006 02:56 AM

Quote:

Originally Posted by Doctor Dre
Thanks for your time but what I want to do is :

when there is no index file, it just redirects to the site URL.
Basicly i got hundreads of folders containing galleries but do not use any index page. users try too type new folders to see if there are more galleries... so i want to use the 404 traffic to feed a tgp.

Use this then:

Code:

ErrorDocument 404 http://www.domaintoredirectto.com/pagetoredirectto.html

Doctor Dre 08-23-2006 02:59 AM

Quote:

Originally Posted by Webby
Got ya!

We talking 404's to cover this?

ErrorDocument 404 /yourpage.htm

If they hit my root directory up and the folder exist it's not a 404 error ...

Webby 08-23-2006 03:07 AM

Quote:

Originally Posted by Doctor Dre
If they hit my root directory up and the folder exist it's not a 404 error ...

OK!!! Not getting bits yet...

If you have a local drive mirror of this content - how about getting a dir listing and making up one default index.htm which simply redirects to "wherever" and letting a batch file stuff a copy into each dir?

Doctor Dre 08-23-2006 03:10 AM

Quote:

Originally Posted by Webby
OK!!! Not getting bits yet...

If you have a local drive mirror of this content - how about getting a dir listing and making up one default index.htm which simply redirects to "wherever" and letting a batch file stuff a copy into each dir?

Too much trouble I have gigs of content on there and I don't wanna waste the day.

There is a htaccess code... I know it cauz i was using it... I overwrote it by accident.

Webby 08-23-2006 03:15 AM

Ah... OK Doc... So can be covered at the server end..

Any clues as to what was used in the htaccess?

Where is ServerGenius when ya need him? :winkwink:

boldy 08-23-2006 03:20 AM

in htaccess (in your DocumentRoot)

Options -indexes
ErrorDocument 403 /

Webby 08-23-2006 03:23 AM

This got anything to do with directory browsing??

Ah... is it an ErrorDocument 403??

TheSwed 08-23-2006 03:33 AM

Take a look here http://www.freewebmasterhelp.com/tutorials/htaccess/2

maybe you find what you looking for :2 cents:

boldy 08-23-2006 03:35 AM

Quote:

Originally Posted by Webby
This got anything to do with directory browsing??

Ah... is it an ErrorDocument 403??


Well when you turn off directory browsing using : Options -Indexes

then it turns into a 403 forbidden error :thumbsup

Webby 08-23-2006 03:39 AM

Quote:

Originally Posted by boldy
Well when you turn off directory browsing using : Options -Indexes

then it turns into a 403 forbidden error :thumbsup

Got to be something like that which fits whatever is needed :winkwink:


All times are GMT -7. The time now is 04:17 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123