Today I wanted to modify my .htaccess file to "redirect" every URL request from www.example.com/site/ to http://example.com/site/.
I used this code:
Code: Select all
#Rewrites www URLS to non-www URLS
RewriteCond %{HTTP_HOST} ^www.benjamin-karl.com$ [NC]
RewriteRule ^(.*)$ http://benjamin-karl.com/$1 [R=301,L]
This is my file right now:
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1&gdir=$0 [QSA]
Every input is welcome

greez, opa