Forum Moderators: phranque
# Always use www in the domain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([a-z.]+)?example\.com$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .? http://www.%1example.com%{REQUEST_URI} [R=301]
# Always use www in the domain
# redirect ANY other domain that doesn't match www.example.com to main domain
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301]
# redirect ANY other domain that doesn't match www.example.com to main domain
# Set a default home directory, (this subfolder always loads)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ /en/ [R=301]
</IfModule>
# Set a default home directory, (this subfolder always loads)
# disable ETags #
Header unset ETag
FileETag None
# disable ETags #
# BEGIN add gZip compression
<IfModule deflate_module>
<IfModule filter_module>
AddOutputFilterByType DEFLATE text/plain text/html
AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf
AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf
</IfModule>
</IfModule>
# END add gZip compression
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##
### BEGIN TIMEZONE
SetEnv TZ Asia/Bangkok
### END TIMEZONE
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
[edited by: phranque at 12:10 am (utc) on Dec 29, 2014]
[edit reason] Please Use example.com [webmasterworld.com] [/edit]
what we now want to do is redirect a few parked domains (not "all" parked domains) to specific urls, whilst leaving any others that are not specifically redirected continuing to redirect to the primary domain.
I apologize if I'm coming across rude
But if visitor accesses "any" other parked domain, they'd continue to be redirected to the primary domain (a catchall as it were).
RewriteCond %{HTTP_HOST} !(parkeddomain1|parkeddomain2|example)\.com$ [NC] or maybe you're looking for a solution like:
RewriteCond %{HTTP_HOST} !(parkeddomain1|parkeddomain2|example)\.com$ [NC]
RewriteCond %{HTTP_HOST} parkeddomain1 [NC]
RewriteRule .? http://www.example.com/specialpage1 [R=301,L]
RewriteCond %{HTTP_HOST} parkeddomain2 [NC]
RewriteRule .? http://www.example.com/specialpage2 [R=301,L]
RewriteCond %{HTTP_HOST} !example\.com
RewriteRule .? http://www.example.com/genericpage [R=301,L]