Forum Moderators: phranque
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteCond %{HTTP_HOST} ^.+\.example\.com$
RewriteCond %{REQUEST_URI} !^(www¦ftp)$
RewriteCond %{REQUEST_FILENAME} !^/home/example/public_html/
RewriteRule ^(.*)$ %{HTTP_HOST}$1 [C]
RewriteRule ^(.*)\.example\.com/ /index.php?a=prog&det=$1 [QSA,L]
but if i request:
h_ttp://pickup.example.com/images/
it take me to:
h_ttp://www.example.com/images/ but i need to take me to:
h_ttp://www.example.com/index.php?a=prog&det=pickup&img
i try to add to htaccess code this:
RewriteRule ^(.*)\.example\.com/images/ /index.php?a=prog&det=$1&img[QSA,L]
but no effect. please help me with this problem..
[edited by: coopster at 1:40 pm (utc) on Dec. 26, 2008]
[edit reason] please use example.com, thanks! [/edit]
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com
RewriteCond %1 !^www$
RewriteRule ^images/ /index.php?a=prog&det=%1&img [QSA,L]
#
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com
RewriteCond %1 !^www$
RewriteRule !^index\.php$ /index.php?a=prog&det=%1 [QSA,L]
The modified original rule (now the second rule) checks to be sure that the requested URL-path is not already "index.php" in order to prevent an 'infinite' rewriting loop.
Note that in .htaccess, URL-paths examined by RewriteRule will never start with a slash. However, URL-paths examined using RewriteCond %{REQUEST_URI} will always start with a slash. Design your regular-expressions patterns with this in mind.
RewriteConds apply only to the single RewriteRule that follows them, and that may have been the main problem.
Jim