Forum Moderators: phranque
RewriteEngine On
RewriteCond %{HTTP_HOST} !^m.domain.com$
RewriteCond %{HTTP_HOST} !^wii.domain.com$
RewriteCond %{HTTP_USER_AGENT} "ipad|nintendo wii|playstation 3" [NC]
RewriteRule ^(.*)$ wii.domain.com [L,R=302]
RewriteCond %{HTTP_HOST} !^m.domain.com$
RewriteCond %{HTTP_HOST} !^wii.domain.com$
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "dang|doco|erics|hipt|inno|ipaq|iphone|ipod|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|nintendo dsi|noki|opwv" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|playstation portable|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windows ce|iemobile|mini|mmp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]
RewriteRule ^(.*)$ m.domain.com [L,R=302]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^versions/mobile/(.*)$ m.domain.com [L,R=302]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^versions/console/(.*)$ wii.domain.com [L,R=302] RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^m.example.com$
RewriteCond %{HTTP_HOST} !^wii.example.com$
RewriteCond %{HTTP_USER_AGENT} "ipad|nintendo wii|playstation 3" [NC]
RewriteRule ^/(.*)$ http://wii.example.com [L,R=302]
RewriteCond %{HTTP_HOST} !^m.example.com$
RewriteCond %{HTTP_HOST} !^wii.example.com$
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "dang|doco|erics|hipt|inno|ipaq|iphone|ipod|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|nintendo dsi|noki|opwv" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|playstation portable|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windows ce|iemobile|mini|mmp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]
RewriteRule ^/(.*)$ http://m.example.com [L,R=302]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^/versions/mobile/(.*)$ http://m.example.com [L,R=302]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^/versions/console/(.*)$ http://wii.example.com [L,R=302] [edited by: jdMorgan at 10:59 pm (utc) on Jun 14, 2010]
[edit reason] example.com [/edit]
RewriteEngine on
#
RewriteBase /
#
RewriteCond %{HTTP_HOST} ^www\.example\.com
RewriteRule ^/versions/mobile/(.*)$ http://m.example.com/$1 [L,R=301]
#
RewriteCond %{HTTP_HOST} ^www\.example\.com
RewriteRule ^/versions/console/(.*)$ http://wii.example.com/$1 [L,R=301]
#
RewriteCond %{HTTP_HOST} !^m\.example\.com
RewriteCond %{HTTP_HOST} !^wii\.example\.com
RewriteCond %{HTTP_USER_AGENT} ipad|nintendo\ wii|playstation\ 3 [NC]
RewriteRule ^/(.*)$ http://wii.example.com/$1 [L,R=303]
#
RewriteCond %{HTTP_HOST} !^m\.example\.com
RewriteCond %{HTTP_HOST} !^wii\.example\.com
RewriteCond %{HTTP_ACCEPT} text/vnd\.wap.wml|application/vnd\.wap\.xhtml\+xml [NC,OR]
RewriteCond %{HTTP_USER_AGENT} acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} dang|doco|erics|hipt|inno|ipaq|iphone|ipod|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|nintendo\ dsi|noki|opwv [NC,OR]
RewriteCond %{HTTP_USER_AGENT} palm|pana|pant|pdxg|phil|playstation\ portable|pluc|port|prox|qtek|qwap|sage|sams|sany [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo [NC,OR]
RewriteCond %{HTTP_USER_AGENT} teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi [NC,OR]
RewriteCond %{HTTP_USER_AGENT} wapp|wapr|webc|winw|winw|xda|xda- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} up\.browser|up\.link|windows\ ce|iemobile|mini|mmp [NC,OR]
RewriteCond %{HTTP_USER_AGENT} symbian|midp|wap|phone|pocket|mobile|pda|psp [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]
RewriteRule ^/(.*)$ http://m.example.com/$1 [L,R=303]
# Make index.php the directory index page
DirectoryIndex index.php
# Block directory listings
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Force WWW in front of URL
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} !^m\.example\.com
RewriteCond %{HTTP_HOST} !^wii\.example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
# Redirect mobile subfolder to mobile subdomain
RewriteCond %{HTTP_HOST} ^www\.example\.com
RewriteRule ^/versions/mobile/(.*)$ http://m.example.com/$1 [L,R=301]
# Redirect console subfolder to console subdomain
RewriteCond %{HTTP_HOST} ^www\.example\.com
RewriteRule ^/versions/console/(.*)$ http://wii.example.com/$1 [L,R=301]
# Redirect WWW access from console to console subdomain
RewriteCond %{HTTP_HOST} !^m\.example\.com
RewriteCond %{HTTP_HOST} !^wii\.example\.com
RewriteCond %{HTTP_USER_AGENT} ipad|nintendo\ wii|playstation\ 3 [NC]
RewriteRule ^/(.*)$ http://wii.example.com/$1 [L,R=303]
# Redirect WWW access from mobile to mobile subdomain
RewriteCond %{HTTP_HOST} !^m\.example\.com
RewriteCond %{HTTP_HOST} !^wii\.example\.com
RewriteCond %{HTTP_ACCEPT} text/vnd\.wap.wml|application/vnd\.wap\.xhtml\+xml [NC,OR]
RewriteCond %{HTTP_USER_AGENT} acs|alav|alca|amoi|andr|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} dang|doco|erics|hipt|inno|ipaq|iphone|ipod|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|nintendo\ dsi|noki|opwv [NC,OR]
RewriteCond %{HTTP_USER_AGENT} palm|pana|pant|pdxg|phil|playstation\ portable|pluc|port|prox|qtek|qwap|sage|sams|sany [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo [NC,OR]
RewriteCond %{HTTP_USER_AGENT} teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi [NC,OR]
RewriteCond %{HTTP_USER_AGENT} wapp|wapr|webc|winw|winw|xda|xda- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} up\.browser|up\.link|windows\ ce|iemobile|mini|mmp [NC,OR]
RewriteCond %{HTTP_USER_AGENT} symbian|midp|wap|phone|pocket|mobile|pda|psp [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]
RewriteRule ^/(.*)$ http://m.example.com/$1 [L,R=303]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
# Force WWW in hostname
RewriteCond %{HTTP_HOST} !^(www|m|wii)\.example\.com\.?(:[0-9]+)?)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L] RewriteRule ^(system.*)$ /index.php?/$1 [L]
# Make index.php the directory index page
DirectoryIndex index.php
# Block directory listings
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
## EXTERNAL NARROW ##
# Redirect mobile subfolder to mobile subdomain
RewriteCond %{HTTP_HOST} ^www\.example\.com
RewriteRule ^versions/mobile/(.*)$ http://m.example.com/$1 [L,R=301]
## EXTERNAL NARROW ##
# Redirect console subfolder to console subdomain
RewriteCond %{HTTP_HOST} ^www\.example\.com
RewriteRule ^versions/console/(.*)$ http://wii.example.com/$1 [L,R=301]
## EXTERNAL BROAD ##
# Redirect WWW access from console to console subdomain
RewriteCond %{HTTP_HOST} !^(m|wii)\.example\.com
RewriteCond %{HTTP_USER_AGENT} ipad|nintendo\ wii|playstation\ 3 [NC]
RewriteRule ^(.*)$ http://wii.example.com/$1 [L,R=303]
## EXTERNAL BROAD ##
# Redirect WWW access from mobile to mobile subdomain
RewriteCond %{HTTP_HOST} !^m\.example\.com
RewriteCond %{HTTP_HOST} !^wii\.example\.com
RewriteCond %{HTTP_ACCEPT} text/vnd\.wap.wml|application/vnd\.wap\.xhtml\+xml [NC,OR]
RewriteCond %{HTTP_USER_AGENT} acs|alav|alca|amoi|andr|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} dang|doco|erics|hipt|inno|ipaq|iphone|ipod|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|nintendo\ dsi|noki|opwv [NC,OR]
RewriteCond %{HTTP_USER_AGENT} palm|pana|pant|pdxg|phil|playstation\ portable|pluc|port|prox|qtek|qwap|sage|sams|sany [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo [NC,OR]
RewriteCond %{HTTP_USER_AGENT} teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi [NC,OR]
RewriteCond %{HTTP_USER_AGENT} wapp|wapr|webc|winw|winw|xda|xda- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} up\.browser|up\.link|windows\ ce|iemobile|mini|mmp [NC,OR]
RewriteCond %{HTTP_USER_AGENT} symbian|midp|wap|phone|pocket|mobile|pda|psp [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]
RewriteRule ^(.*)$ http://m.example.com/$1 [L,R=303]
## EXTERNAL BROAD ##
# Force WWW in hostname
RewriteCond %{HTTP_HOST} !^(www|m|wii)\.example\.com\.?(:[0-9]+)?)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
## INTERNAL NARROW ##
# Removes access to the system folder by users.
RewriteRule ^(system.*)$ /index.php?/$1 [L]
## INTERNAL NARROW ##
# Removes access to the application folder by users.
RewriteRule ^(application.*)$ /index.php?/$1 [L]
## INTERNAL BROAD ##
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
## EXTERNAL BROAD ##
# Redirect WWW access from mobile to mobile subdomain
[b]RewriteCond %{HTTP_HOST} !^(m|wii)\.example\.com
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC][/b]
RewriteCond %{HTTP_ACCEPT} text/vnd\.wap.wml|application/vnd\.wap\.xhtml\+xml [NC,OR]
RewriteCond %{HTTP_USER_AGENT} acs|alav|alca|amoi|andr|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} dang|doco|erics|hipt|inno|ipaq|iphone|ipod|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|nintendo\ dsi|noki|opwv [NC,OR]
RewriteCond %{HTTP_USER_AGENT} palm|pana|pant|pdxg|phil|playstation\ portable|pluc|port|prox|qtek|qwap|sage|sams|sany [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo [NC,OR]
RewriteCond %{HTTP_USER_AGENT} teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi [NC,OR]
RewriteCond %{HTTP_USER_AGENT} wapp|wapr|webc|winw|winw|xda|xda- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} up\.browser|up\.link|windows\ ce|iemobile|mini|mmp [NC,OR]
RewriteCond %{HTTP_USER_AGENT} symbian|midp|wap|phone|pocket|mobile|pda|psp [NC]
RewriteRule ^(.*)$ http://m.example.com/$1 [L,R=303]
#
## EXTERNAL BROAD ##
# Force WWW in hostname
RewriteCond %{HTTP_HOST} !^(www|m|wii)\.example\.com\.?(:[0-9]+)?)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# Last and least-specific external redirect above, first and most-specific internal rewrite below
#
## INTERNAL NARROW ##
[b]# Removes access to the system and application folders by users
RewriteRule ^((system|application).*)$ /index.php?/$1 [L][/b]
#
## INTERNAL BROAD ##
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
[b]RewriteRule $1 !(^index\.php|\.(gif|jpe?g|png|ico|css|js))$[/b]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
## EXTERNAL BROAD ##
# Force WWW in hostname
RewriteCond %{HTTP_HOST} !^(www|m|wii)\.example\.com\.?(:[0-9]+)?)?$
RewriteRule ^(.*)$ http://www.stimulent.com/$1 [L,R=301]