Hey guys
I need a little bit of help with my htaccess
basically I have my url being: http://www.jake-norton.co.uk
But because I have more than one site on the server (by 2 domains) I have had to redirect the user to the folder making the url: http://www.jake-norton.co.uk/j/
I was just wondering if its possible for me to remove the /j/ using htaccess
Thanks a lot guys
Jake151
Page 1 of 1
.htaccess help!
#2
Posted 10 August 2009 - 05:42 PM
Looks like mod_rewrite could be what you want. Something like this should work (this is untested, so you may have to tweak it):
The first condition ensures that if you're actually requesting the /j/ subdirectory, you get that subdirectory without rewriting - this avoids an infinite loop. Then the second condition+rule ensure that visitors to (www.)jake-norton.co.uk but not inside the /j/ subdirectory are actually shown the equivalent pages from the /j/ subdirectory. This will only not work if you have an actual directory /j/j/ since then /j/ would be the actual directory /j/ and would not redirect to /j/j/, if you see what I mean
Let me know if that works for you
RewriteCond %{REQUEST_URI} ! ^/j/.*
RewriteCond %{REMOTE_HOST} ^(www.)?jake-norton.co.uk$
RewriteRule ^/(.*)$ /j/$1The first condition ensures that if you're actually requesting the /j/ subdirectory, you get that subdirectory without rewriting - this avoids an infinite loop. Then the second condition+rule ensure that visitors to (www.)jake-norton.co.uk but not inside the /j/ subdirectory are actually shown the equivalent pages from the /j/ subdirectory. This will only not work if you have an actual directory /j/j/ since then /j/ would be the actual directory /j/ and would not redirect to /j/j/, if you see what I mean
Let me know if that works for you
Share this topic:
Page 1 of 1
Help
















