/ Published in: Apache
Few useful HTACCESS examples.
Expand |
Embed | Plain Text
############################################## # NON WWW TO WWW ############################################## Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/robots\.txt$ RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] ############################################## # DIRECTORY OR FILE ############################################## Redirect 301 /directory http://www.pcrf-kids.org/newdirectory/ ############################################## # HELP DEAL WITH URL STRINGS ############################################## RewriteRule ^lyonapartment/services(.*) http://www.lyoncommunities.com/about-us? [R=301,L] ############################################## # NEW DOMAIN ############################################## RewriteCond %{HTTP_HOST} ^lyonautumnchase.com$ [OR] RewriteCond %{HTTP_HOST} ^www.lyonautumnchase.com$ RewriteRule ^(.*)$ http://www.lyoncommunities.com/communities/welcome/autumn-chase [R=301,L]
Comments
Subscribe to comments
You need to login to post a comment.

redirects to www.example.com/www
Simply rewrite the last line to: RewriteRule ^(.*)$ http://www.example.com/ [R=301,L]
Cheers and thanks for sharing!