Hi All, Before I ask I would like to let you all know I am not tech and have no clue about Apache or the .htaccess file. I have one main .htaccess file in my root folder that redirects Non www. requests to www. requests so that it is always http://www.example.com. Ok, I have a directory within my website lets call it "/example/". That also has a .htaccess file that does some re writing for a script I did not write. The problem is within this directory the redirect from the non www. to the www. does not work, I guess the .htaccess file in the "/example/" folder stops the main one from working in this folder. How would i add in the code that would do the redirect but not break the script? Here is the .htaccess file: Options +FollowSymlinks RewriteEngine on RewriteRule ^([^/\.]+)/?$ /example/index.php?page=regions&r=$1 [NC] RewriteRule ^example/search/?$ /example/index.php?page=search [NC] RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /example/index.php?page=towns&r=$1&t=$2 [NC] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /example/index.php?page=show&r=$1&t=$2&n=$3&id=$4 [NC] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /example/index.php?page=show&r=$1&t=$2&n=$3&id=$4&s=$5 [NC] Code (markup): So, how do I change this so that it will always redirect from http://example.com/example/blah/ to http://www.example.com/example/blah/ Any ideas and also any other information I need to provide? One confused Guy - RJ
domain.com/.htaccess RewriteEngine on Options +FollowSymlinks RewriteCond %{HTTP_HOST} ^DOMAIN\.com [NC] RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [R=301,L] RewriteBase / RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ example/index.php?page=show&r=$1&t=$2&n=$3&id=$4&s=$5 [NC] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ example/index.php?page=show&r=$1&t=$2&n=$3&id=$4 [NC] RewriteRule ^([^/\.]+)/([^/\.]+)/?$ example/index.php?page=towns&r=$1&t=$2 [NC] RewriteRule ^([^/\.]+)/?$ example/index.php?page=regions&r=$1 [NC] RewriteRule ^example/search/?$ example/index.php?page=search [NC] and dump the .htaccess file in the directory.
Hi, Thank you for the reply, I have added that into the .htaccess file, there is a problem now. The .htacces file is in the directory /example/ (not the root) so when someone trys to get to: http://example.co.uk/example/Northern_Ireland/ it redirects to http://www.example.co.uk/Northern_Ireland/ (file not found 404) Any ideas Nintendo?
Hi All, Got it - Just added /example/ to this line: RewriteRule ^(.*)$ http://www.DOMAIN.com/example/$1 [R=301,L] And that has worked! Great Work - Thanks nintendo! Some green for you