![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 55,243
|
htaccess/modrewrite help
anyone use htaccess to create sub domains on the fly?
i want to make it so if i am viewing a directory listing, when clicking on parent directory it goes back to the root of the sub domain, not the domain/subs/name. here is my htaccess. Code:
# disable direct access to .htaccess <Files .htaccess> order allow,deny deny from all </Files> # disable direct access to other files <FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$"> Order Allow,Deny Deny from all </FilesMatch> # cache images and flash content for one month <FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$"> Header set Cache-Control "max-age=2592000" </FilesMatch> # cache text, css, and javascript files for one week <FilesMatch ".(js|css|pdf|txt)$"> Header set Cache-Control "max-age=604800" </FilesMatch> # cache html and htm files for one day <FilesMatch ".(html|htm)$"> Header set Cache-Control "max-age=43200" </FilesMatch> # enable symbolic links Options +FollowSymLinks # lets use some rewrites RewriteEngine On # remove www RewriteCond %{HTTP_HOST} ^www\.(domain\.com)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] # treat .php as .html # example: /downloads/files.php will work as /downloads/files.html RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{REQUEST_URI} ^(/.+\.)html$ [NC] RewriteCond %{DOCUMENT_ROOT}%1php -f RewriteRule \.html$ %1php [NC,QSA,L] # images on the root. # example /images/chicago.jpg will work as /chicago.jpg RewriteCond %{DOCUMENT_ROOT}/images%{REQUEST_URI} -f [OR] RewriteCond %{DOCUMENT_ROOT}/images%{REQUEST_URI} -d RewriteRule !^images(/.*)?$ /images%{REQUEST_URI} [QSA,L] # sub domains on the fly RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$ [NC] RewriteCond %{HTTP_HOST} ^(.*\.)?([^\.]+)\.domain\.com$ [NC] RewriteCond %{DOCUMENT_ROOT}/subs/%2%{REQUEST_URI}/ -d RewriteRule [^/]$ http://%2.domain.com%{REQUEST_URI}/ [R=301,L] RewriteCond %{HTTP_HOST} ^.*\.([^\.]+\.domain\.com)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$ [NC] RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC] RewriteCond %1:::%{REQUEST_URI} !^(.+):::/subs/\1(/.*)?$ [NC] RewriteCond %{DOCUMENT_ROOT}/subs/%1/ -d RewriteRule ^(.*)$ /subs/%1/$1 [QSA,L]
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence. ![]() WP Stuff |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Damn Right I Kiss Ass!
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,391
|
Code:
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] RewriteCond %{HTTP_HOST} ^(sub)\.domain\.com RewriteRule ^(.*) http://www.domain.com/subdomains/sub/$1 [L,P] |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Damn Right I Kiss Ass!
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,391
|
P flag is supposed to keep things going via internal proxy instead of making the switch in the browsers address bar. I didn't test it though...
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
So Fucking Banned
Industry Role:
Join Date: Apr 2001
Location: N.Y. -Long Island --
Posts: 122,992
|
Code:
# pussy lips RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$ [NC] pussy lips RewriteCond %{HTTP_HOST} ^(.*\.)?([^\.]+)\.domain\.com$ [NC] RewriteCond %{DOCUMENT_ROOT}/subs/%2%{REQUEST_URI}/ -d RewriteRule [^/]$ http://%2.domain.com%{REQUEST_URI}/ [R=301,L] RewriteCond %{HTTP_HOST} ^.*\.([^\.]+\.domain\.com)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$ [NC] RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC] RewriteCond %1:::%{REQUEST_URI} !^(.+):::/subs/\1(/.*)?$ [NC] RewriteCond %{DOCUMENT_ROOT}/subs/%1/ -d pussy lips RewriteRule ^(.*)$ /subs/%1/$1 [QSA,L] |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Industry Role:
Join Date: Mar 2003
Location: San Diego
Posts: 32,174
|
Be careful with that..
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |