Web Design Forum: .htaccess help! - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

.htaccess help! Rate Topic: -----

#1 User is offline   Jake151 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 261
  • Joined: 14-March 09
  • Reputation: 9
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 07 August 2009 - 08:42 PM

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
0

#2 User is offline   Connetu_C 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 427
  • Joined: 12-December 08
  • Reputation: 25
  • Gender:Male
  • Location:London, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

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):

RewriteCond %{REQUEST_URI} ! ^/j/.*
RewriteCond %{REMOTE_HOST} ^(www.)?jake-norton.co.uk$
RewriteRule ^/(.*)$ /j/$1

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 :wacko:

Let me know if that works for you :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users