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 question $50 award. (https://gfy.com/showthread.php?t=935332)

zentz 10-26-2009 06:56 AM

.htaccess question $50 award.
 
I have multiple dirs like this

/my.subdomain.com/subfolder_1/0001/index.html
/my.subdomain.com/subfolder_2/0002/index.html
/my.subdomain.com/subfolder_3/0003/index.html

They all have their own index.html file. I want to make them share one identical index.html which will be located in /my.subdomain.com/index.html

How can i do this with .htaccess? Is it possible or do i need to use symlinks?

$50 epassporte to the first one that post the solution.

Thank you

Klen 10-26-2009 07:04 AM

If you have ssh access,then you can simply do ln index.html //my.subdomain.com/subfolder_1/0001/index.html
which will create symbolic link to original file.Repeat same command to all subfolders where you want to have identical file.

comeplay 10-26-2009 07:11 AM

ln -s /my.subdomain.com/index.html index.html

Klen 10-26-2009 07:14 AM

Quote:

Originally Posted by comeplay (Post 16465732)
ln -s /my.subdomain.com/index.html index.html

Yes need to be s switch.

zentz 10-26-2009 07:19 AM

the problem is there are hundreds of subfolders so it needs to be a batch command or something.

Klen 10-26-2009 07:20 AM

Well in htaccess this should work:
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule (.*) http://www.mydomain.com/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !^/web
RewriteCond /home/path/to/public_html/%{REQUEST_FILENAME} !-f
RewriteCond /home/path/to/public_html/%{REQUEST_FILENAME} !-d
RewriteCond /home/path/to/public_html/%{REQUEST_FILENAME} !-l
RewriteRule ^(.+) /web$1

darksoul 10-26-2009 08:05 AM

this works for both situations:
/subfolder/0001/index.html and
/subfolder/0001/

Code:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^(/.*)/index.html$ [OR]
RewriteCond %{REQUEST_URI} ^(/.*)?/$
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteRule . /index.html [L]


V_RocKs 10-26-2009 09:16 AM

Darksoul... good guy if you need something done on the server!

zentz 10-26-2009 10:57 AM

darksoul provided the best solution so the money was sent to him.

thank you

Fat Panda 10-26-2009 11:24 AM

good work darksoul

seeandsee 10-26-2009 11:29 AM

nice done

darksoul 10-26-2009 11:57 AM

nice working with you

Robocrop 10-26-2009 12:43 PM

Code:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^(/.*)/index.html$ [OR]
RewriteCond %{REQUEST_URI} ^(/.*)?/$
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteRule . /index.html [L]

DO I WINNN???????????


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