The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Dec 02, 2005 6:01 am 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Tue Oct 25, 2005 11:54 pm
Posts: 96
Location: Melbourne, Victoria, Australia
OK, I have Joomla installed in a subdirectory on our server.  Don't really want to move it to the root directory, as there are some other bits of software installed on it.  Currently we have a redirect set up within the index.html file, but are now looking for a more elegant solution

I know that within the .htaccess you can add the following to get everything redirected to the correction location.

Code:
Redirect permanent /index.html http://www.mysite.com/joomla


However, the problem with that is the fact that you then get http://www.mysite.com/joomla in the URL for the browser.  Which really isn't very nice.

So, with .htaccess, you can also do the following (taken from here - http://httpd.apache.org/docs/2.0/misc/rewriteguide.html):

Quote:
Assume we have recently renamed the page foo.html to bar.html and now want to provide the old URL for backward compatibility. Actually we want that users of the old URL even not recognize that the pages was renamed.

Code:
RewriteEngine  on
RewriteBase    /~quux/
RewriteRule    ^foo\.html$  bar.html


Now, what I am wondering, has anyone tried anything like this? And if you have, has it worked?  What happens with subdirectories under the root directory that you still want to use?  Is there still access to those?  Or does more code have to be added to be able to handle that?

Any suggestions or comments appreciated :)

_________________
http://ozreef.org- OZ REEF
http://www.masa.asn.au/masawiki/index.php?title=Main_Page - RTAW Reefpedia


Top
 Profile  
 
PostPosted: Fri Dec 02, 2005 7:06 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Thu Aug 18, 2005 4:08 pm
Posts: 209
Location: Austria
I've never used this myself, mostly because I use another approach to redirect visitors to different subdirectories, depending on what domainname they enter into their browser. I just think it very likely that with the second solution you may face some serious problems should you ever consider to use SEF URLs.

Migth be interesting to check how Apache handles two different rewrite rulesets for the same request, though.

Kurt

_________________
Kurt Banfi

http://www.clockbit.com <- Developer of Contacts XTD
http://www.open-sef.org <- Chief Designer ;)


Top
 Profile  
 
PostPosted: Wed Dec 07, 2005 10:16 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Tue Oct 25, 2005 11:54 pm
Posts: 96
Location: Melbourne, Victoria, Australia
I actually use SEF already.

So no one has set up a redirect like this then?

I am going to continue searching around the rest of the online communittee, i.e. non Joomla, and see if something similar has been done elsewhere......

_________________
http://ozreef.org- OZ REEF
http://www.masa.asn.au/masawiki/index.php?title=Main_Page - RTAW Reefpedia


Top
 Profile  
 
PostPosted: Thu Dec 08, 2005 9:32 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Oct 01, 2005 7:46 pm
Posts: 44
Any joy?

I am trying to do the same thing and so far getting server errors.

There is code in the sample htaccess.txt that looks like it might do the trick but doesn't quite work.


Top
 Profile  
 
PostPosted: Fri Dec 23, 2005 4:24 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Dec 20, 2005 11:52 am
Posts: 47
I'm also trying to do this, am really confused and do not appear to find an answer elsewhere in the forum.

I understand that if joomla is installed in a subdirectory called joomla off the web root folder the the following line in .htaccess applies:
Code:
RewriteBase /joomla


My first problem was that I didn't know where to put the .htaccess: in the web root folder or in the joomla folder? Or both? (can it hurt to have it in both?)

I did manage to get the SEF URLS working except that they all had /joomla/ in the url... so in the configuration file I removed "/joomla" from $mosConfig_live_site.

My second problem then is that some of my images stopped working (actually it was the banners from the banner component) because of the base URL in the web page HTML... I would have assumed that the RewriteBase command in the .htaccess would have sorted this out.

My third problem is that I get an error accessing the website using only the base URL (because there's no index.php in the web root folder) so in order to see the site I have to redirect to http://mydomain/joomla/... again, I would have thought that the RewriteBase command would have taken care of this.

There are two possibilities: 1) I have no clue what I'm doing (true) and have understood incorrectly how these things work, or 2) my .htaccess is behaving badly (too much champaign over the festive season).

Any suggestions?


Top
 Profile  
 
PostPosted: Fri Dec 30, 2005 8:53 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Fri Dec 30, 2005 8:41 am
Posts: 1
this is from the apache url rewrite guide - looks like this is exactly what you're trying to do, or am i mistaken?

Quote:
Moved DocumentRoot

Description:
Usually the DocumentRoot of the webserver directly relates to the URL ``/''. But often this data is not really of top-level priority, it is perhaps just one entity of a lot of data pools. For instance at our Intranet sites there are /e/www/ (the homepage for WWW), /e/sww/ (the homepage for the Intranet) etc. Now because the data of the DocumentRoot stays at /e/www/ we had to make sure that all inlined images and other stuff inside this data pool work for subsequent requests.

Solution:
We just redirect the URL / to /e/www/. While is seems trivial it is actually trivial with mod_rewrite, only. Because the typical old mechanisms of URL Aliases (as provides by mod_alias and friends) only used prefix matching. With this you cannot do such a redirection because the DocumentRoot is a prefix of all URLs. With mod_rewrite it is really trivial:

    RewriteEngine on
    RewriteRule  ^/$  /e/www/  [R]


Top
 Profile  
 
PostPosted: Fri Jan 13, 2006 10:28 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Mon Sep 19, 2005 7:34 pm
Posts: 57
Location: Christchurch, New Zealand
check http://forum.joomla.org/index.php/topic,27413.0.html

You'll find some help there.  Also a google search for .htaccess tuturial should get some useful results.

Regards.
Bevan/

_________________
http://lucion.co.nz


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 



Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group