View Single Post
Old 10-09-2011, 06:42 PM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,294
Quote:
Originally Posted by georgeyw View Post
never found a generator to do many of the stuff I do

Code:
# enables domain.com/search/search-term.html 

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^search/(.+)\.html$ /index.php?s=$1 [QSA,L]
Code:
# make /pics/askj12.jpg work as /askj12.jpg

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/data%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}/data%{REQUEST_URI} -d
RewriteRule !^pics(/.*)?$ /pics%{REQUEST_URI} [QSA,L]
Code:
# from: http://www.example.com/profile.php?user=username 
# to: http://username.example.com 

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule .* - [L]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com$ [NC]
RewriteRule ^$ /profile.php?user=%1 [QSA,L]
Code:
# rewrite rules to generate on the fly

# /sub/evil.domain.com/pics --> http://evil.domain.com/pics
# /sub/content.domain2.com/clicks --> http://content.domain2.com/clicks
# /sub/ab.domain3.com/moo --> http://ab.domain3.com/moo

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?[^\.]+\.[^\.]+$ [NC]
RewriteCond %{HTTP_HOST} ^(.*\.)?([^\.]+\.[^\.]+\.[^\.]+)$ [NC]
RewriteCond %{DOCUMENT_ROOT}/sub/%2%{REQUEST_URI}/ -d
RewriteRule [^/]$ http://%2%{REQUEST_URI}/ [R=301,L]
RewriteCond %{HTTP_HOST} ^(.*\.)([^\.]+\.[^\.]+\.[^\.]+)$ [NC]
RewriteRule ^(.*)$ http://%2/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^(www\.)?[^\.]+\.[^\.]+$ [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+\.[^\.]+\.[^\.]+)$ [NC]
RewriteCond %1:::%{REQUEST_URI} !^(.+):::/sub/\1(/.*)?$ [NC]
RewriteCond %{DOCUMENT_ROOT}/sub/%1/ -d
RewriteRule ^(.*)$ /sub/%1/$1 [QSA,L]
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote